提交 227f2673 编写于 作者: Z Zhiqi Song 提交者: Zheng Zengkai

crypto: hisilicon/hpre - fix resource leak in remove process

mainline inclusion
from v6.1-rc4
commit 45e6319b
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I5ZHPY
CVE: NA

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=45e6319bd5f2154d8b8c9f1eaa4ac030ba0d330c

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

In hpre_remove(), when the disable operation of qm sriov failed,
the following logic should continue to be executed to release the
remaining resources that have been allocated, instead of returning
directly, otherwise there will be resource leakage.
Signed-off-by: NZhiqi Song <songzhiqi1@huawei.com>
Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: NJiangshui Yang <yangjiangshui@h-partners.com>
Reviewed-by: NXiu Jianfeng <xiujianfeng@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 bed94bc1
...@@ -1437,18 +1437,12 @@ static int hpre_probe(struct pci_dev *pdev, const struct pci_device_id *id) ...@@ -1437,18 +1437,12 @@ static int hpre_probe(struct pci_dev *pdev, const struct pci_device_id *id)
static void hpre_remove(struct pci_dev *pdev) static void hpre_remove(struct pci_dev *pdev)
{ {
struct hisi_qm *qm = pci_get_drvdata(pdev); struct hisi_qm *qm = pci_get_drvdata(pdev);
int ret;
hisi_qm_pm_uninit(qm); hisi_qm_pm_uninit(qm);
hisi_qm_wait_task_finish(qm, &hpre_devices); hisi_qm_wait_task_finish(qm, &hpre_devices);
hisi_qm_alg_unregister(qm, &hpre_devices); hisi_qm_alg_unregister(qm, &hpre_devices);
if (qm->fun_type == QM_HW_PF && qm->vfs_num) { if (qm->fun_type == QM_HW_PF && qm->vfs_num)
ret = hisi_qm_sriov_disable(pdev, true); hisi_qm_sriov_disable(pdev, true);
if (ret) {
pci_err(pdev, "Disable SRIOV fail!\n");
return;
}
}
hpre_debugfs_exit(qm); hpre_debugfs_exit(qm);
hisi_qm_stop(qm, QM_NORMAL); hisi_qm_stop(qm, QM_NORMAL);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册