Commit 573a5282 authored by Chenghai Huang's avatar Chenghai Huang Committed by 白凤
Browse files

crypto: hisilicon/sec - Fix memory leak for sec resource release

maillist inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I9GMIW
CVE: NA

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev.git/commit/?id=bba4250757b4



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

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.

Fixes: 7ad650cb ("crypto: hisilicon/sec - Fix memory leak for sec resource release")
Signed-off-by: default avatarChenghai Huang <huangchenghai2@huawei.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: default avatarJangShui Yang <yangjiangshui@h-partners.com>
Signed-off-by: default avatarXiaoFeng Ma <maxiaofeng14@h-partners.com>
parent e4e88909
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -481,8 +481,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 sec_ctx *ctx, struct sec_qp_ctx *qp_ctx)