This is a re-submission of a patch I sent to the linux-scsi mailing list several months back (http://marc.theaimsgroup.com/?l=linux-scsi&m=111290555013699&w=2). In summary, the patch fixes: 1. an oops in sg_remove, if it's called when the device has been opened, which occurs because the sg_dev_arr_lock is dropped too soon and sg_remove_sfp frees the sdp before sg_remove is done with it. 2. a case in sg_remove_sfp where a reference isn't dropped, but should be. I found a problem with my original patch... I was calling scsi_device_put (which may eventually sleep, at least in the 2.6.9 kernel I'm using) from sg_remove_sfp while holding a spinlock. Hence the revised patch. The attached patch is against kernel 2.6.14rc2. I retested in a recent kernel to verify that these problems still exist and are fixed by the patch. Nate Dailey Stratus Technologies Signed-off-by: Nate Dailey <nate.dailey@xxxxxxxxxxx>
Attachment:
sg.c.patch2614rc2nd
Description: sg.c.patch2614rc2nd