Home Home > GIT Browse > stable
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHannes Reinecke <hare@suse.de>2017-12-13 14:25:31 +0100
committerHannes Reinecke <hare@suse.de>2017-12-13 14:25:31 +0100
commite430cfcd4b1b46cfce183bf09d17c18d317daadf (patch)
tree2902663687e4b2c1cb66346761c2b57a95b2bc4f
parent8eead5f549b14cc276d2f4ca4694797860712c9d (diff)
scsi: check for device state in __scsi_remove_target()rpm-4.4.103-6.33
(bsc#1072589).
-rw-r--r--patches.fixes/scsi-check-for-device-state-in-__scsi_remove_target.patch37
-rw-r--r--series.conf1
2 files changed, 38 insertions, 0 deletions
diff --git a/patches.fixes/scsi-check-for-device-state-in-__scsi_remove_target.patch b/patches.fixes/scsi-check-for-device-state-in-__scsi_remove_target.patch
new file mode 100644
index 0000000000..d8e792b8c3
--- /dev/null
+++ b/patches.fixes/scsi-check-for-device-state-in-__scsi_remove_target.patch
@@ -0,0 +1,37 @@
+From: Hannes Reinecke <hare@suse.de>
+Date: Wed, 13 Dec 2017 14:15:03 +0100
+Subject: [PATCH] scsi: check for device state in __scsi_remove_target()
+References: bsc#1072589
+Patch-Mainline: submitted linux-scsi 2017/12/13
+
+As it turned out device_get() doesn't use kref_get_unless_zero(),
+so we will be always getting a device pointer.
+So we need to check for the device state in __scsi_remove_target()
+to avoid tripping over deleted objects.
+
+Fixes: fbce4d9 ("scsi: fixup kernel warning during rmmod()")
+
+Signed-off-by: Hannes Reinecke <hare@suse.com>
+---
+ drivers/scsi/scsi_sysfs.c | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
+index 995539f..e176c7d 100644
+--- a/drivers/scsi/scsi_sysfs.c
++++ b/drivers/scsi/scsi_sysfs.c
+@@ -1343,7 +1343,10 @@ static void __scsi_remove_target(struct scsi_target *starget)
+ * check.
+ */
+ if (sdev->channel != starget->channel ||
+- sdev->id != starget->id ||
++ sdev->id != starget->id)
++ continue;
++ if (sdev->sdev_state == SDEV_DEL ||
++ sdev->sdev_state == SDEV_CANCEL ||
+ !get_device(&sdev->sdev_gendev))
+ continue;
+ spin_unlock_irqrestore(shost->host_lock, flags);
+--
+1.8.5.6
+
diff --git a/series.conf b/series.conf
index 89ba664db7..dc4ba46330 100644
--- a/series.conf
+++ b/series.conf
@@ -6517,6 +6517,7 @@
patches.fixes/scsi-sg-close-race-condition-in-sg_remove_sfp_userco.patch
patches.fixes/scsi-sg-don-t-return-bogus-Sg_requests.patch
patches.fixes/scsi-sg-only-check-for-dxfer_len-greater-than-256M.patch
+ patches.fixes/scsi-check-for-device-state-in-__scsi_remove_target.patch
# ATA update
patches.drivers/ata-0001-ahci-per-port-msix-support.patch