From 677bae68d0893b9ef290d86608f2ca78648113bc Mon Sep 17 00:00:00 2001 From: Luo Jiaxing Date: Mon, 15 Apr 2019 16:33:00 +0800 Subject: [PATCH] scsi: hisi_sas: prevent ops->hardreset() from executing at controller reset driver inclusion category: bugfix bugzilla: NA CVE: NA ------------------------------------------------- In the function of hisi_sas_init_device(), we add ops->hardreset() to clear affiliation of STP target port or handle [STP pending] state recently. Function hisi_sas_init_device() will be call when device found or controller reset. At controller reset, we call hisi_sas_init_device to re-init the disks by TMF or softreset(in case of ATA devices), so ops->hardreset() is unnecessary and it also will cause some delay at controller reset. Besides, ops->hardreset() will call sas_ex_phy_discover() and it set attached_sas_addr of ex_phy base on the respond of smp command: SMP_DISCOVER. If we call this function at error handle, it may misleading the handle flow of libsas. So we prevent ops->hardreset() from executing at controller reset. Signed-off-by: Luo Jiaxing Reviewed-by: Xiang Chen Signed-off-by: John Garry Reviewed-by: Jason Yan Signed-off-by: Yang Yingliang --- drivers/scsi/hisi_sas/hisi_sas_main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/hisi_sas/hisi_sas_main.c b/drivers/scsi/hisi_sas/hisi_sas_main.c index 6e9a76cfd567..110b405f6b0b 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_main.c +++ b/drivers/scsi/hisi_sas/hisi_sas_main.c @@ -756,7 +756,8 @@ static int hisi_sas_init_device(struct domain_device *device) * STP target port */ local_phy = sas_get_local_phy(device); - if (!scsi_is_sas_phy_local(local_phy)) { + if (!scsi_is_sas_phy_local(local_phy) && + !test_bit(HISI_SAS_RESET_BIT, &hisi_hba->flags)) { unsigned long deadline = ata_deadline(jiffies, 20000); struct sata_device *sata_dev = &device->sata_dev; struct ata_host *ata_host = sata_dev->ata_host; -- GitLab