[SRU][Q][PATCH 1/1] crypto: hisilicon/sec2 - prevent req used-after-free for sec

Cengiz Can cengiz.can at canonical.com
Thu Jul 16 23:56:49 UTC 2026


From: Wenkai Lin <linwenkai6 at hisilicon.com>

During packet transmission, if the system is under heavy load,
the hardware might complete processing the packet and free the
request memory (req) before the transmission function finishes.
If the software subsequently accesses this req, a use-after-free
error will occur. The qp_ctx memory exists throughout the packet
sending process, so replace the req with the qp_ctx.

Fixes: f0ae287c5045 ("crypto: hisilicon/sec2 - implement full backlog mode for sec")
Signed-off-by: Wenkai Lin <linwenkai6 at hisilicon.com>
Signed-off-by: Chenghai Huang <huangchenghai2 at huawei.com>
Signed-off-by: Herbert Xu <herbert at gondor.apana.org.au>
(cherry picked from commit 67b53a660e6bf0da2fa8d8872e897a14d8059eaf)
CVE-2026-53055
Assisted-by: kybele:claude-opus-4.8
Signed-off-by: Cengiz Can <cengiz.can at canonical.com>
---
 drivers/crypto/hisilicon/sec2/sec_crypto.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/crypto/hisilicon/sec2/sec_crypto.c b/drivers/crypto/hisilicon/sec2/sec_crypto.c
index d044ded0f290..65ede5c45abe 100644
--- a/drivers/crypto/hisilicon/sec2/sec_crypto.c
+++ b/drivers/crypto/hisilicon/sec2/sec_crypto.c
@@ -235,7 +235,7 @@ static int qp_send_message(struct sec_req *req)
 
 	spin_unlock_bh(&qp_ctx->req_lock);
 
-	atomic64_inc(&req->ctx->sec->debug.dfx.send_cnt);
+	atomic64_inc(&qp_ctx->ctx->sec->debug.dfx.send_cnt);
 	return -EINPROGRESS;
 }
 
-- 
2.43.0




More information about the kernel-team mailing list