From: Xiang Chen Date: Wed, 17 Jan 2018 16:46:54 +0000 (+0800) Subject: scsi: hisi_sas: fix a bug in hisi_sas_dev_gone() X-Git-Tag: v4.16-rc1~140^2~6 X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=commitdiff_plain;h=0d762b3af2a5b5095fec18aa4d61f408638aa9ca;p=linux.git 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: Xiang Chen Signed-off-by: John Garry Signed-off-by: Martin K. Petersen --- diff --git a/drivers/scsi/hisi_sas/hisi_sas_main.c b/drivers/scsi/hisi_sas/hisi_sas_main.c index 791462d7fbfc..2d4dbed03ee3 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_main.c +++ b/drivers/scsi/hisi_sas/hisi_sas_main.c @@ -796,7 +796,6 @@ static void hisi_sas_dev_gone(struct domain_device *device) hisi_hba->hw->clear_itct(hisi_hba, sas_dev); device->lldd_dev = NULL; - memset(sas_dev, 0, sizeof(*sas_dev)); } if (hisi_hba->hw->free_device)