提交 b70d37bf 编写于 作者: A Alan Stern 提交者: James Bottomley

[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: NAlan Stern <stern@rowland.harvard.edu>
Signed-off-by: NJames Bottomley <James.Bottomley@SteelEye.com>
上级 f631b4be
...@@ -870,8 +870,12 @@ static int scsi_probe_and_add_lun(struct scsi_target *starget, ...@@ -870,8 +870,12 @@ static int scsi_probe_and_add_lun(struct scsi_target *starget,
out_free_sdev: out_free_sdev:
if (res == SCSI_SCAN_LUN_PRESENT) { if (res == SCSI_SCAN_LUN_PRESENT) {
if (sdevp) { if (sdevp) {
scsi_device_get(sdev); if (scsi_device_get(sdev) == 0) {
*sdevp = sdev; *sdevp = sdev;
} else {
__scsi_remove_device(sdev);
res = SCSI_SCAN_NO_RESPONSE;
}
} }
} else { } else {
if (sdev->host->hostt->slave_destroy) if (sdev->host->hostt->slave_destroy)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册