Home Home > GIT Browse
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichal Suchanek <msuchanek@suse.de>2019-03-20 17:47:56 +0100
committerMichal Suchanek <msuchanek@suse.de>2019-03-20 17:48:35 +0100
commitab6b8c2532d60513e3d56aba04078fdd1ea75412 (patch)
tree42fd0318e4457f99f26daacb2f4cc4e77a57fa48
parent6cd23c78b26d6f75d33c7f842e14446179edd1de (diff)
ibmvscsi: Protect ibmvscsi_head from concurrent modificaiton
(bsc#1119019).
-rw-r--r--patches.drivers/ibmvscsi-Protect-ibmvscsi_head-from-concurrent-modif.patch59
-rw-r--r--series.conf2
2 files changed, 61 insertions, 0 deletions
diff --git a/patches.drivers/ibmvscsi-Protect-ibmvscsi_head-from-concurrent-modif.patch b/patches.drivers/ibmvscsi-Protect-ibmvscsi_head-from-concurrent-modif.patch
new file mode 100644
index 0000000000..757904740e
--- /dev/null
+++ b/patches.drivers/ibmvscsi-Protect-ibmvscsi_head-from-concurrent-modif.patch
@@ -0,0 +1,59 @@
+From f8b79e65484f1718126936de7f9154b3b5eeda73 Mon Sep 17 00:00:00 2001
+From: Tyrel Datwyler <tyreld@linux.vnet.ibm.com>
+Date: Wed, 19 Dec 2018 22:33:12 -0800
+Subject: [PATCH] ibmvscsi: Protect ibmvscsi_head from concurrent modificaiton
+
+References: bsc#1119019
+Patch-mainline: no, testing
+
+For each ibmvscsi host created during a probe or destroyed during a
+remove we either add or remove that host to/from the global ibmvscsi_head
+list. This runs the risk of concurrent modification.
+
+This patch adds a simple spinlock around the list modification calls to
+prevent concurrent updates as is done similarly in the ibmvfc driver and
+ipr driver.
+
+Fixes: 32d6e4b6e4ea ("scsi: ibmvscsi: add vscsi hosts to global list_head")
+Cc: stable@vger.kernel.org # v4.10+
+Signed-off-by: Tyrel Datwyler <tyreld@linux.vnet.ibm.com>
+Acked-by: Michal Suchanek <msuchanek@suse.de>
+---
+ drivers/scsi/ibmvscsi/ibmvscsi.c | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/drivers/scsi/ibmvscsi/ibmvscsi.c b/drivers/scsi/ibmvscsi/ibmvscsi.c
+index 1deb0a9f14a6..16b3f23c7ef5 100644
+--- a/drivers/scsi/ibmvscsi/ibmvscsi.c
++++ b/drivers/scsi/ibmvscsi/ibmvscsi.c
+@@ -96,6 +96,7 @@ static int client_reserve = 1;
+ static char partition_name[97] = "UNKNOWN";
+ static unsigned int partition_number = -1;
+ static LIST_HEAD(ibmvscsi_head);
++static DEFINE_SPINLOCK(ibmvscsi_driver_lock);
+
+ static struct scsi_transport_template *ibmvscsi_transport_template;
+
+@@ -2274,7 +2275,9 @@ static int ibmvscsi_probe(struct vio_dev *vdev, const struct vio_device_id *id)
+ }
+
+ dev_set_drvdata(&vdev->dev, hostdata);
++ spin_lock(&ibmvscsi_driver_lock);
+ list_add_tail(&hostdata->host_list, &ibmvscsi_head);
++ spin_unlock(&ibmvscsi_driver_lock);
+ return 0;
+
+ add_srp_port_failed:
+@@ -2296,7 +2299,9 @@ static int ibmvscsi_probe(struct vio_dev *vdev, const struct vio_device_id *id)
+ static int ibmvscsi_remove(struct vio_dev *vdev)
+ {
+ struct ibmvscsi_host_data *hostdata = dev_get_drvdata(&vdev->dev);
++ spin_lock(&ibmvscsi_driver_lock);
+ list_del(&hostdata->host_list);
++ spin_unlock(&ibmvscsi_driver_lock);
+ unmap_persist_bufs(hostdata);
+ release_event_pool(&hostdata->pool, hostdata);
+ ibmvscsi_release_crq_queue(&hostdata->queue, hostdata,
+--
+2.20.1
+
diff --git a/series.conf b/series.conf
index d6d548525f..6c4395f212 100644
--- a/series.conf
+++ b/series.conf
@@ -21173,6 +21173,8 @@
patches.arch/selftests-powerpc-Fix-core-pkey-for-default-execute-.patch
patches.arch/selftests-powerpc-Fix-ptrace-pkey-for-default-execut.patch
+ patches.drivers/ibmvscsi-Protect-ibmvscsi_head-from-concurrent-modif.patch
+
########################################################
# cephfs
########################################################