stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 5.10.y] tls: separate no-async decryption request handling from async
@ 2026-08-03 19:51 Wengang Wang
  2026-08-04  1:05 ` Sasha Levin
  0 siblings, 1 reply; 2+ messages in thread
From: Wengang Wang @ 2026-08-03 19:51 UTC (permalink / raw)
  To: stable; +Cc: wen.gang.wang, borisp, john.fastabend, daniel, kuba, davem

From: Sabrina Dubroca <sd@queasysnail.net>

If we're not doing async, the handling is much simpler. There's no
reference counting, we just need to wait for the completion to wake us
up and return its result.

We should preferably also use a separate crypto_wait. I'm not seeing a
UAF as I did in the past, I think aec7961916f3 ("tls: fix race between
async notify and socket close") took care of it.

This will make the next fix easier.

CVE: CVE-2024-58240
Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
Link: https://lore.kernel.org/r/47bde5f649707610eaef9f0d679519966fc31061.1709132643.git.sd@queasysnail.net
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
(cherry picked from commit 41532b785e9d79636b3815a64ddf6a096647d011)
Signed-off-by: Wengang Wang <wen.gang.wang@oracle.com>

Conflicts:
	net/tls/tls_sw.c
---
 net/tls/tls_sw.c | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/net/tls/tls_sw.c b/net/tls/tls_sw.c
index 1732e3549a57..29650fa54666 100644
--- a/net/tls/tls_sw.c
+++ b/net/tls/tls_sw.c
@@ -257,18 +257,21 @@ static int tls_do_decryption(struct sock *sk,
 					  tls_decrypt_done, skb);
 		atomic_inc(&ctx->decrypt_pending);
 	} else {
+		DECLARE_CRYPTO_WAIT(wait);
+
 		aead_request_set_callback(aead_req,
 					  CRYPTO_TFM_REQ_MAY_BACKLOG,
-					  crypto_req_done, &ctx->async_wait);
+					  crypto_req_done, &wait);
+
+		ret = crypto_aead_decrypt(aead_req);
+		if (ret == -EINPROGRESS || ret == -EBUSY)
+			ret = crypto_wait_req(ret, &wait);
+		return ret;
 	}
 
 	ret = crypto_aead_decrypt(aead_req);
-	if (ret == -EINPROGRESS) {
-		if (async)
-			return ret;
-
-		ret = crypto_wait_req(ret, &ctx->async_wait);
-	}
+	if (ret == -EINPROGRESS)
+		return ret;
 
 	if (async)
 		atomic_dec(&ctx->decrypt_pending);
-- 
2.50.1 (Apple Git-155)


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 5.10.y] tls: separate no-async decryption request handling from async
  2026-08-03 19:51 [PATCH 5.10.y] tls: separate no-async decryption request handling from async Wengang Wang
@ 2026-08-04  1:05 ` Sasha Levin
  0 siblings, 0 replies; 2+ messages in thread
From: Sasha Levin @ 2026-08-04  1:05 UTC (permalink / raw)
  To: stable
  Cc: Sasha Levin, wen.gang.wang, borisp, john.fastabend, daniel, kuba,
	davem

On Mon, Aug 03, 2026 at 12:51:49PM -0700, Wengang Wang wrote:
>Subject: [PATCH 5.10.y] tls: separate no-async decryption request handling from async

Queued for 5.10, thanks.

-- 
Thanks,
Sasha

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-08-04  1:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-03 19:51 [PATCH 5.10.y] tls: separate no-async decryption request handling from async Wengang Wang
2026-08-04  1:05 ` Sasha Levin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).