fix sg leak when scsi_execute_async fails
Subsystems (2)
PATCH 1/1 fix sg leak when scsi_execute_async fails
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.
Patch was made against scsi-misc. Not sure if this should also go to stable?
drivers/scsi/sg.c +1 -0
@@ -748,6 +748,7 @@ sg_common_write(Sg_fd * sfp, Sg_request/* * most likely out of mem, but could also be a bad map */ +sg_finish_rem_req (srp);return -ENOMEM ; }else return 0 ;
Quoted 3 lines · Mike Christie
Doug found a bug where if
scsi_execute_asyncfails, we are leaking sg resources.scsi_do_reqnever failed so we did not have to handle that case before.
When a SCSI command request falls foul of the extra requirements in lk 2.6.16 (e.g. max_sectors), the resulting ENOMEM leaves unfinished business in the sg driver's own data structures. This can be seen with 'cat /proc/scs/sg/debug' .
Quoted 2 lines
Patch was made against scsi-misc. Not sure if this should also go to stable?
I think it should. It fixes a bug on an error path by adding the same cleanup call as found on other paths.
Quoted 1 line
Signed-off-by Mike Christie <[email protected]>
Doug Gilbert
Quoted 14 lines
drivers/scsi/sg.c +1
-0@@ -748,6 +748,7 @@ sg_common_write(Sg_fd * sfp, Sg_request/* * most likely out of mem, but could also be a bad map */ +sg_finish_rem_req (srp);return -ENOMEM ; }else return 0 ;