* [PATCH] crypto: hisilicon/qm - fix missing destroy qp_idr
@ 2022-08-13 10:34 Yang Shen
2022-08-19 11:04 ` Herbert Xu
0 siblings, 1 reply; 2+ messages in thread
From: Yang Shen @ 2022-08-13 10:34 UTC (permalink / raw)
To: herbert, davem; +Cc: linux-kernel, linux-crypto, wangzhou1, liulongfang
From: Weili Qian <qianweili@huawei.com>
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: Weili Qian <qianweili@huawei.com>
Signed-off-by: Yang Shen <shenyang39@huawei.com>
---
drivers/crypto/hisilicon/qm.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/crypto/hisilicon/qm.c b/drivers/crypto/hisilicon/qm.c
index a519ddad0af5..aaabea3c2935 100644
--- a/drivers/crypto/hisilicon/qm.c
+++ b/drivers/crypto/hisilicon/qm.c
@@ -6283,8 +6283,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);
@@ -6300,7 +6300,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;
--
2.33.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] crypto: hisilicon/qm - fix missing destroy qp_idr
2022-08-13 10:34 [PATCH] crypto: hisilicon/qm - fix missing destroy qp_idr Yang Shen
@ 2022-08-19 11:04 ` Herbert Xu
0 siblings, 0 replies; 2+ messages in thread
From: Herbert Xu @ 2022-08-19 11:04 UTC (permalink / raw)
To: Yang Shen; +Cc: davem, linux-kernel, linux-crypto, wangzhou1, liulongfang
On Sat, Aug 13, 2022 at 06:34:52PM +0800, Yang Shen wrote:
> From: Weili Qian <qianweili@huawei.com>
>
> 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: Weili Qian <qianweili@huawei.com>
> Signed-off-by: Yang Shen <shenyang39@huawei.com>
> ---
> drivers/crypto/hisilicon/qm.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
Patch applied. Thanks.
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-08-19 11:05 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-13 10:34 [PATCH] crypto: hisilicon/qm - fix missing destroy qp_idr Yang Shen
2022-08-19 11:04 ` Herbert Xu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).