From 51a98e77f1e6661e367f962597fea452f458b5b9 Mon Sep 17 00:00:00 2001 From: chenxiang Date: Mon, 11 Nov 2019 15:00:38 +0800 Subject: [PATCH] scsi: hisi_sas: Put function hisi_sas_debugfs_exit() after free_irqs and destroy workqueue when removing hisi_sas driver driver inclusion category: bugfix bugzilla: NA CVE: NA Currently we call function hisi_sas_debugfs_exit() to remove debugfs_dir before free irqs and destroy workqueue when removing hisi_sas driver. If dump is triggered before function hisi_sas_debugfs_exit() but debugfs_work may be called after it, so it may refer to already removed debugfs_dir which will cause NULL pointer dereference. To avoid it, put function hisi_sas_debugfs_exit() after free_irqs and destroy workqueue when removing hisi_sas driver. Signed-off-by: Xiang Chen Reviewed-by: John Garry Feature or Bugfix:Bugfix Signed-off-by: chenxiang (M) Reviewed-by: huangdaode Signed-off-by: Yang Yingliang --- drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c index caab49f2f7d8..23bf4750f358 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c @@ -3488,8 +3488,6 @@ static void hisi_sas_v3_remove(struct pci_dev *pdev) struct hisi_hba *hisi_hba = sha->lldd_ha; struct Scsi_Host *shost = sha->core.shost; - hisi_sas_debugfs_exit(hisi_hba); - if (timer_pending(&hisi_hba->timer)) del_timer(&hisi_hba->timer); @@ -3501,6 +3499,7 @@ static void hisi_sas_v3_remove(struct pci_dev *pdev) pci_release_regions(pdev); pci_disable_device(pdev); hisi_sas_free(hisi_hba); + hisi_sas_debugfs_exit(hisi_hba); scsi_host_put(shost); } -- GitLab