Commit 7c0ecd40 authored by Xiang Chen's avatar Xiang Chen Committed by Martin K. Petersen

scsi: hisi_sas: Relocate call to hisi_sas_debugfs_exit()

Currently we call function hisi_sas_debugfs_exit() to remove debugfs_dir
before freeing interrupt irqs and destroying workqueue in the driver remove
path.

If a 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.

Link: https://lore.kernel.org/r/1573551059-107873-4-git-send-email-john.garry@huawei.comSigned-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 547fde8b
...@@ -3302,8 +3302,6 @@ static void hisi_sas_v3_remove(struct pci_dev *pdev) ...@@ -3302,8 +3302,6 @@ static void hisi_sas_v3_remove(struct pci_dev *pdev)
struct hisi_hba *hisi_hba = sha->lldd_ha; struct hisi_hba *hisi_hba = sha->lldd_ha;
struct Scsi_Host *shost = sha->core.shost; struct Scsi_Host *shost = sha->core.shost;
hisi_sas_debugfs_exit(hisi_hba);
if (timer_pending(&hisi_hba->timer)) if (timer_pending(&hisi_hba->timer))
del_timer(&hisi_hba->timer); del_timer(&hisi_hba->timer);
...@@ -3315,6 +3313,7 @@ static void hisi_sas_v3_remove(struct pci_dev *pdev) ...@@ -3315,6 +3313,7 @@ static void hisi_sas_v3_remove(struct pci_dev *pdev)
pci_release_regions(pdev); pci_release_regions(pdev);
pci_disable_device(pdev); pci_disable_device(pdev);
hisi_sas_free(hisi_hba); hisi_sas_free(hisi_hba);
hisi_sas_debugfs_exit(hisi_hba);
scsi_host_put(shost); scsi_host_put(shost);
} }
......
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