Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fbfce5c5 authored by Xiang Chen's avatar Xiang Chen Committed by Greg Kroah-Hartman
Browse files

scsi: hisi_sas: Check sas_port before using it

[ Upstream commit 8c39673d5474b95374df2104dc1f65205c5278b8 ]

Need to check the structure sas_port before using it.

Link: https://lore.kernel.org/r/1573551059-107873-2-git-send-email-john.garry@huawei.com


Signed-off-by: default avatarXiang Chen <chenxiang66@hisilicon.com>
Signed-off-by: default avatarJohn Garry <john.garry@huawei.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent f13a4453
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -789,12 +789,13 @@ static void hisi_sas_port_notify_formed(struct asd_sas_phy *sas_phy)
	struct hisi_hba *hisi_hba = sas_ha->lldd_ha;
	struct hisi_sas_phy *phy = sas_phy->lldd_phy;
	struct asd_sas_port *sas_port = sas_phy->port;
	struct hisi_sas_port *port = to_hisi_sas_port(sas_port);
	struct hisi_sas_port *port;
	unsigned long flags;

	if (!sas_port)
		return;

	port = to_hisi_sas_port(sas_port);
	spin_lock_irqsave(&hisi_hba->lock, flags);
	port->port_attached = 1;
	port->id = phy->port_id;