From 0b4967941706c2c36d63562e32fa55aa861a0144 Mon Sep 17 00:00:00 2001 From: Wenkai Lin Date: Tue, 6 Jun 2023 16:38:52 +0800 Subject: [PATCH] crypto: hisilicon/sec - fix for resource leak driver inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I7BANJ CVE: NA ---------------------------------------------------------------------- The hisi_acc_sg_buf_unmap function is not executed before return ret, causing resource leakage. Signed-off-by: Wenkai Lin Signed-off-by: JiangShui Yang --- drivers/crypto/hisilicon/sec2/sec_crypto.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/crypto/hisilicon/sec2/sec_crypto.c b/drivers/crypto/hisilicon/sec2/sec_crypto.c index 9ff1c8d771d8..27db9fa65ddf 100644 --- a/drivers/crypto/hisilicon/sec2/sec_crypto.c +++ b/drivers/crypto/hisilicon/sec2/sec_crypto.c @@ -984,6 +984,7 @@ static int sec_cipher_map(struct sec_ctx *ctx, struct sec_req *req, ret = sec_aead_mac_init(a_req); if (unlikely(ret)) { dev_err(dev, "fail to init mac data for ICV!\n"); + hisi_acc_sg_buf_unmap(dev, src, req->in); return ret; } } -- GitLab