diff options
author | Alan Stern <stern@rowland.harvard.edu> | 2005-07-26 16:30:40 +0200 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.(none)> | 2005-09-10 18:21:02 +0200 |
commit | b70d37bf61f278f9d9adf17c52af6b2d0ae7800c (patch) | |
tree | 2b1e207cf93ac43e0787204764cf1b231fda3c93 /drivers/scsi | |
parent | [SCSI] lpfc: use wwn_to_u64() transport helper (diff) | |
download | linux-b70d37bf61f278f9d9adf17c52af6b2d0ae7800c.tar.xz linux-b70d37bf61f278f9d9adf17c52af6b2d0ae7800c.zip |
[SCSI] Fix module removal/device add race
This patch (as546) fixes an oops-causing failure to check the return code
from scsi_device_get. The call can return an error if the LLD is being
unloaded from memory.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/scsi_scan.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c index 76577fae60fa..a0975c78b968 100644 --- a/drivers/scsi/scsi_scan.c +++ b/drivers/scsi/scsi_scan.c @@ -870,8 +870,12 @@ static int scsi_probe_and_add_lun(struct scsi_target *starget, out_free_sdev: if (res == SCSI_SCAN_LUN_PRESENT) { if (sdevp) { - scsi_device_get(sdev); - *sdevp = sdev; + if (scsi_device_get(sdev) == 0) { + *sdevp = sdev; + } else { + __scsi_remove_device(sdev); + res = SCSI_SCAN_NO_RESPONSE; + } } } else { if (sdev->host->hostt->slave_destroy) |