From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Chenghai Huang <huangchenghai2@huawei.com>,
Herbert Xu <herbert@gondor.apana.org.au>,
Sasha Levin <sashal@kernel.org>,
liulongfang@huawei.com, davem@davemloft.net,
linux-crypto@vger.kernel.org
Subject: [PATCH AUTOSEL 6.1 3/9] crypto: hisilicon/sec - Fix memory leak for sec resource release
Date: Sun, 26 May 2024 05:43:04 -0400 [thread overview]
Message-ID: <20240526094312.3413460-3-sashal@kernel.org> (raw)
In-Reply-To: <20240526094312.3413460-1-sashal@kernel.org>
From: Chenghai Huang <huangchenghai2@huawei.com>
[ Upstream commit bba4250757b4ae1680fea435a358d8093f254094 ]
The AIV is one of the SEC resources. When releasing resources,
it need to release the AIV resources at the same time.
Otherwise, memory leakage occurs.
The aiv resource release is added to the sec resource release
function.
Signed-off-by: Chenghai Huang <huangchenghai2@huawei.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/crypto/hisilicon/sec2/sec_crypto.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/crypto/hisilicon/sec2/sec_crypto.c b/drivers/crypto/hisilicon/sec2/sec_crypto.c
index cae7c414bdaf4..09a20307d01e3 100644
--- a/drivers/crypto/hisilicon/sec2/sec_crypto.c
+++ b/drivers/crypto/hisilicon/sec2/sec_crypto.c
@@ -479,8 +479,10 @@ static void sec_alg_resource_free(struct sec_ctx *ctx,
if (ctx->pbuf_supported)
sec_free_pbuf_resource(dev, qp_ctx->res);
- if (ctx->alg_type == SEC_AEAD)
+ if (ctx->alg_type == SEC_AEAD) {
sec_free_mac_resource(dev, qp_ctx->res);
+ sec_free_aiv_resource(dev, qp_ctx->res);
+ }
}
static int sec_alloc_qp_ctx_resource(struct hisi_qm *qm, struct sec_ctx *ctx,
--
2.43.0
next prev parent reply other threads:[~2024-05-26 9:43 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-26 9:43 [PATCH AUTOSEL 6.1 1/9] md: Fix overflow in is_mddev_idle Sasha Levin
2024-05-26 9:43 ` [PATCH AUTOSEL 6.1 2/9] padata: Disable BH when taking works lock on MT path Sasha Levin
2024-05-26 9:43 ` Sasha Levin [this message]
2024-05-26 9:43 ` [PATCH AUTOSEL 6.1 4/9] io_uring/sqpoll: work around a potential audit memory leak Sasha Levin
2024-05-26 9:43 ` [PATCH AUTOSEL 6.1 5/9] rcutorture: Fix rcu_torture_one_read() pipe_count overflow comment Sasha Levin
2024-05-26 9:43 ` [PATCH AUTOSEL 6.1 6/9] rcutorture: Make stall-tasks directly exit when rcutorture tests end Sasha Levin
2024-05-26 9:43 ` [PATCH AUTOSEL 6.1 7/9] rcutorture: Fix invalid context warning when enable srcu barrier testing Sasha Levin
2024-05-26 9:43 ` [PATCH AUTOSEL 6.1 8/9] binfmt_elf: Leave a gap between .bss and brk Sasha Levin
2024-05-26 9:43 ` [PATCH AUTOSEL 6.1 9/9] block/ioctl: prefer different overflow check Sasha Levin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240526094312.3413460-3-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=davem@davemloft.net \
--cc=herbert@gondor.apana.org.au \
--cc=huangchenghai2@huawei.com \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=liulongfang@huawei.com \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox