[CVE-2017-18232][A][PATCH 09/11] scsi: libsas: use flush_workqueue to process disco events synchronously

Khalid Elmously khalid.elmously at canonical.com
Wed May 23 02:27:57 UTC 2018


From: Jason Yan <yanaijie at huawei.com>

CVE-2017-18232

Now we are processing sas event and discover event in different
workqueues.  It's safe to wait the discover event done in the sas event
work. Use flush_workqueue() to insure the disco and revalidate events
processed synchronously so that the whole discover and revalidate
process will not be interrupted by other events.

Signed-off-by: Jason Yan <yanaijie at huawei.com>
CC: John Garry <john.garry at huawei.com>
CC: Johannes Thumshirn <jthumshirn at suse.de>
CC: Ewan Milne <emilne at redhat.com>
CC: Christoph Hellwig <hch at lst.de>
CC: Tomas Henzl <thenzl at redhat.com>
CC: Dan Williams <dan.j.williams at intel.com>
Reviewed-by: Hannes Reinecke <hare at suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen at oracle.com>
(cherry-picked from 517e5153d242cb2dd0a1150d2a7bd6788d501ca9 )
Signed-off-by: Khalid Elmously <khalid.elmously at canonical.com>
---
 drivers/scsi/libsas/sas_port.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/scsi/libsas/sas_port.c b/drivers/scsi/libsas/sas_port.c
index 93266283f51f..64722f42b256 100644
--- a/drivers/scsi/libsas/sas_port.c
+++ b/drivers/scsi/libsas/sas_port.c
@@ -192,6 +192,7 @@ static void sas_form_port(struct asd_sas_phy *phy)
 		si->dft->lldd_port_formed(phy);
 
 	sas_discover_event(phy->port, DISCE_DISCOVER_DOMAIN);
+	flush_workqueue(sas_ha->disco_q);
 }
 
 /**
@@ -277,6 +278,9 @@ void sas_porte_broadcast_rcvd(struct work_struct *work)
 
 	SAS_DPRINTK("broadcast received: %d\n", prim);
 	sas_discover_event(phy->port, DISCE_REVALIDATE_DOMAIN);
+
+	if (phy->port)
+		flush_workqueue(phy->port->ha->disco_q);
 }
 
 void sas_porte_link_reset_err(struct work_struct *work)
-- 
2.17.0





More information about the kernel-team mailing list