Commit 159df073 authored by Yihang Li's avatar Yihang Li Committed by JiangShui
Browse files

scsi: hisi_sas: Set .phy_attached before notifing phyup event HISI_PHYE_PHY_UP_PM

driver inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I8IL6H


CVE: NA

----------------------------------------------------------------------

Currently in directly attached scenario, the phyup event
HISI_PHYE_PHY_UP_PM is notified before .phy_attached is set - this may
cause the phyup work hisi_sas_bytes_dmaed() execution failed and the
attached device will not be found.

To fix it, set .phy_attached before notifing phyup event.

Signed-off-by: default avatarYihang Li <liyihang9@huawei.com>
Signed-off-by: default avatarXiang Chen <chenxiang66@hisilicon.com>
Signed-off-by: default avatarxiabing <xiabing12@h-partners.com>
parent 779f66a7
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -1597,6 +1597,11 @@ static irqreturn_t phy_up_v3_hw(int phy_no, struct hisi_hba *hisi_hba)
	}

	phy->port_id = port_id;
	spin_lock(&phy->lock);
	/* Delete timer and set phy_attached atomically */
	del_timer(&phy->timer);
	phy->phy_attached = 1;
	spin_unlock(&phy->lock);

	/*
	 * Call pm_runtime_get_noresume() which pairs with
@@ -1610,11 +1615,6 @@ static irqreturn_t phy_up_v3_hw(int phy_no, struct hisi_hba *hisi_hba)

	res = IRQ_HANDLED;

	spin_lock(&phy->lock);
	/* Delete timer and set phy_attached atomically */
	del_timer(&phy->timer);
	phy->phy_attached = 1;
	spin_unlock(&phy->lock);
end:
	if (phy->reset_completion)
		complete(phy->reset_completion);