Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b70d37bf authored by Alan Stern's avatar Alan Stern Committed by James Bottomley
Browse files

[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: default avatarAlan Stern <stern@rowland.harvard.edu>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
parent f631b4be
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -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);
			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)