[SCSI] fix sg leak when scsi_execute_async fails
authorMike Christie <michaelc@cs.wisc.edu>
Wed, 22 Mar 2006 22:04:38 +0000 (16:04 -0600)
committerJames Bottomley <jejb@mulgrave.il.steeleye.com>
Thu, 13 Apr 2006 15:13:16 +0000 (10:13 -0500)
Doug found a bug where if scsi_execute_async fails, we are leaking
sg resources. scsi_do_req never failed so we did not have to handle
that case before.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
drivers/scsi/sg.c

index fcf9243dfa7dcc5e4423b1ed5fa6308809d6c6ab..bfa86b378fb9659c18d25a399593f9f431dc0600 100644 (file)
@@ -748,6 +748,7 @@ sg_common_write(Sg_fd * sfp, Sg_request * srp,
                /*
                 * most likely out of mem, but could also be a bad map
                 */
+               sg_finish_rem_req(srp);
                return -ENOMEM;
        } else
                return 0;