Commit 0d762b3a authored by Xiang Chen's avatar Xiang Chen Committed by Martin K. Petersen

scsi: hisi_sas: fix a bug in hisi_sas_dev_gone()

When device gone, NULL pointer can be accessed in free_device callback
if during SAS controller reset as we clear structure sas_dev prior.

Actually we can only set dev_type as SAS_PHY_UNUSED and not clear
structure sas_dev as all the members of structure sas_dev will be
re-initialized after device found.
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>
parent 6379c560
...@@ -796,7 +796,6 @@ static void hisi_sas_dev_gone(struct domain_device *device) ...@@ -796,7 +796,6 @@ static void hisi_sas_dev_gone(struct domain_device *device)
hisi_hba->hw->clear_itct(hisi_hba, sas_dev); hisi_hba->hw->clear_itct(hisi_hba, sas_dev);
device->lldd_dev = NULL; device->lldd_dev = NULL;
memset(sas_dev, 0, sizeof(*sas_dev));
} }
if (hisi_hba->hw->free_device) if (hisi_hba->hw->free_device)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment