From 0c6a0b9a6750e094c41554261b330b35254d8491 Mon Sep 17 00:00:00 2001 From: Jason Yan Date: Thu, 31 Oct 2019 11:48:42 +0800 Subject: [PATCH] scsi: libsas: only clear phy->in_shutdown after shutdown event done mainline inclusion from mainline-5.2-rc6 commit 04cf8b32bc6d3fbc640d5f62b3a14df207d3e1db category: bugfix bugzilla: 16823 CVE: NA --------------------------- When the event queue is full of phy up and down events and reached the threshold, we will queue a shutdown-event, and set phy->in_shutdown so that we will not queue a shutdown-event again. But before the shutdown-event can be executed, every phy-down event will clear phy->in_shutdown and a new shutdown-event will be queued. The queue will be full of these shutdown-events. Fix this by only clear phy->in_shutdown in sas_phye_shutdown(), that is after the first shutdown-event has been executed. Fixes: f12486e06ae8 ("scsi: libsas: shut down the PHY if events reached the threshold") Signed-off-by: Jason Yan CC: John Garry CC: Johannes Thumshirn CC: Ewan Milne CC: Christoph Hellwig CC: Tomas Henzl CC: Dan Williams CC: Hannes Reinecke Reviewed-by: John Garry Signed-off-by: Martin K. Petersen [zhengbin: do not merge patch 71a4a9923122 & 3c236f8cc63b, cause these patches just modify printk info in function sas_phye_shutdown] Signed-off-by: zhengbin Reviewed-by: Jason Yan Signed-off-by: Yang Yingliang --- drivers/scsi/libsas/sas_phy.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/scsi/libsas/sas_phy.c b/drivers/scsi/libsas/sas_phy.c index bf3e1b979ca6..760252b50314 100644 --- a/drivers/scsi/libsas/sas_phy.c +++ b/drivers/scsi/libsas/sas_phy.c @@ -35,7 +35,6 @@ static void sas_phye_loss_of_signal(struct work_struct *work) struct asd_sas_event *ev = to_asd_sas_event(work); struct asd_sas_phy *phy = ev->phy; - phy->in_shutdown = 0; phy->error = 0; sas_deform_port(phy, 1); } @@ -45,7 +44,6 @@ static void sas_phye_oob_done(struct work_struct *work) struct asd_sas_event *ev = to_asd_sas_event(work); struct asd_sas_phy *phy = ev->phy; - phy->in_shutdown = 0; phy->error = 0; } @@ -127,6 +125,7 @@ static void sas_phye_shutdown(struct work_struct *work) } else sas_printk("phy%02d is not enabled, cannot shutdown\n", phy->id); + phy->in_shutdown = 0; } /* ---------- Phy class registration ---------- */ -- GitLab