Commit bf870808 authored by Yihang Li's avatar Yihang Li Committed by JiangShui
Browse files

scsi: hisi_sas: Check whether debugfs is enabled before removing or releasing it

driver inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I8IL6H


CVE: NA

----------------------------------------------------------------------

Hisi_sas debugfs remove should be executed only when debugfs is enabled.
In this patch, check whether debugfs is enabled and then remove it.

Signed-off-by: default avatarYihang Li <liyihang9@huawei.com>
Signed-off-by: default avatarxiabing <xiabing12@h-partners.com>
parent 5bf912e4
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -2942,6 +2942,7 @@ static __exit void hisi_sas_exit(void)
{
	sas_release_transport(hisi_sas_stt);

	if (hisi_sas_debugfs_enable)
		debugfs_remove(hisi_sas_debugfs_dir);
}

+4 −2
Original line number Diff line number Diff line
@@ -4969,6 +4969,7 @@ hisi_sas_v3_probe(struct pci_dev *pdev, const struct pci_device_id *id)
err_out_register_ha:
	scsi_remove_host(shost);
err_out_debugfs:
	if (hisi_sas_debugfs_enable)
		debugfs_exit_v3_hw(hisi_hba);
err_out_ha:
	hisi_sas_free(hisi_hba);
@@ -5016,6 +5017,7 @@ static void hisi_sas_v3_remove(struct pci_dev *pdev)
	pci_release_regions(pdev);
	pci_disable_device(pdev);
	hisi_sas_free(hisi_hba);
	if (hisi_sas_debugfs_enable)
		debugfs_exit_v3_hw(hisi_hba);
	scsi_host_put(shost);
}