提交 fbeaed26 编写于 作者: W Weili Qian 提交者: Zheng Zengkai

crypto: hisilicon/qm - fix missing destroy qp_idr

mainline inclusion
from mainline-v6.1-rc1
commit 116be08f
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I5T7AD
CVE: NA

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

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

In the function hisi_qm_memory_init(), if resource alloc fails after
idr_init, the initialized qp_idr needs to be destroyed.
Signed-off-by: NWeili Qian <qianweili@huawei.com>
Signed-off-by: NYang Shen <shenyang39@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>
Reviewed-by: NYang Shen <shenyang39@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 72662e79
......@@ -6144,8 +6144,8 @@ static int hisi_qm_memory_init(struct hisi_qm *qm)
GFP_ATOMIC);
dev_dbg(dev, "allocate qm dma buf size=%zx)\n", qm->qdma.size);
if (!qm->qdma.va) {
ret = -ENOMEM;
goto err_alloc_qdma;
ret = -ENOMEM;
goto err_destroy_idr;
}
QM_INIT_BUF(qm, eqe, QM_EQ_DEPTH);
......@@ -6161,7 +6161,8 @@ static int hisi_qm_memory_init(struct hisi_qm *qm)
err_alloc_qp_array:
dma_free_coherent(dev, qm->qdma.size, qm->qdma.va, qm->qdma.dma);
err_alloc_qdma:
err_destroy_idr:
idr_destroy(&qm->qp_idr);
kfree(qm->factor);
return ret;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册