* [PATCH] crypto: hisilicon/sec2 - prevent req used-after-free for sec
@ 2026-03-21 7:00 Chenghai Huang
2026-03-27 10:09 ` Herbert Xu
0 siblings, 1 reply; 2+ messages in thread
From: Chenghai Huang @ 2026-03-21 7:00 UTC (permalink / raw)
To: herbert, davem
Cc: linux-kernel, linux-crypto, fanghao11, liulongfang, qianweili,
linwenkai6, wangzhou1
From: Wenkai Lin <linwenkai6@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@hisilicon.com>
Signed-off-by: Chenghai Huang <huangchenghai2@huawei.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 15174216d8c4..2471a4dd0b50 100644
--- a/drivers/crypto/hisilicon/sec2/sec_crypto.c
+++ b/drivers/crypto/hisilicon/sec2/sec_crypto.c
@@ -230,7 +230,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.33.0
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] crypto: hisilicon/sec2 - prevent req used-after-free for sec
2026-03-21 7:00 [PATCH] crypto: hisilicon/sec2 - prevent req used-after-free for sec Chenghai Huang
@ 2026-03-27 10:09 ` Herbert Xu
0 siblings, 0 replies; 2+ messages in thread
From: Herbert Xu @ 2026-03-27 10:09 UTC (permalink / raw)
To: Chenghai Huang
Cc: davem, linux-kernel, linux-crypto, fanghao11, liulongfang,
qianweili, linwenkai6, wangzhou1
On Sat, Mar 21, 2026 at 03:00:38PM +0800, Chenghai Huang wrote:
> From: Wenkai Lin <linwenkai6@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@hisilicon.com>
> Signed-off-by: Chenghai Huang <huangchenghai2@huawei.com>
> ---
> drivers/crypto/hisilicon/sec2/sec_crypto.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Patch applied. Thanks.
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-03-27 10:09 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-21 7:00 [PATCH] crypto: hisilicon/sec2 - prevent req used-after-free for sec Chenghai Huang
2026-03-27 10:09 ` Herbert Xu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox