summaryrefslogtreecommitdiff
path: root/drivers/crypto
diff options
context:
space:
mode:
authorChenghai Huang <huangchenghai2@huawei.com>2024-04-07 15:59:58 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-06-27 13:46:14 +0200
commit7c42ce556ff65995c8875c9ed64141c14238e7e6 (patch)
tree1aaee50e00f6b399cca23caab09f1aa16ef0c19e /drivers/crypto
parent4925da08967c875c95a2267aa95bceb18c2d9761 (diff)
downloadlinux-7c42ce556ff65995c8875c9ed64141c14238e7e6.tar.gz
linux-7c42ce556ff65995c8875c9ed64141c14238e7e6.tar.bz2
linux-7c42ce556ff65995c8875c9ed64141c14238e7e6.zip
crypto: hisilicon/sec - Fix memory leak for sec resource release
[ 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>
Diffstat (limited to 'drivers/crypto')
-rw-r--r--drivers/crypto/hisilicon/sec2/sec_crypto.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/crypto/hisilicon/sec2/sec_crypto.c b/drivers/crypto/hisilicon/sec2/sec_crypto.c
index cae7c414bdaf..09a20307d01e 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,