Skip to content

Commit b8a6ff8

Browse files
qsnkuba-moo
authored andcommitted
tls: wait for pending async decryptions if tls_strp_msg_hold fails
Async decryption calls tls_strp_msg_hold to create a clone of the input skb to hold references to the memory it uses. If we fail to allocate that clone, proceeding with async decryption can lead to various issues (UAF on the skb, writing into userspace memory after the recv() call has returned). In this case, wait for all pending decryption requests. Fixes: 84c61fe ("tls: rx: do not use the standard strparser") Reported-by: Jann Horn <[email protected]> Signed-off-by: Sabrina Dubroca <[email protected]> Link: https://patch.msgid.link/b9fe61dcc07dab15da9b35cf4c7d86382a98caf2.1760432043.git.sd@queasysnail.net Signed-off-by: Jakub Kicinski <[email protected]>
1 parent b6fe4c2 commit b8a6ff8

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

net/tls/tls_sw.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1641,8 +1641,10 @@ static int tls_decrypt_sg(struct sock *sk, struct iov_iter *out_iov,
16411641

16421642
if (unlikely(darg->async)) {
16431643
err = tls_strp_msg_hold(&ctx->strp, &ctx->async_hold);
1644-
if (err)
1645-
__skb_queue_tail(&ctx->async_hold, darg->skb);
1644+
if (err) {
1645+
err = tls_decrypt_async_wait(ctx);
1646+
darg->async = false;
1647+
}
16461648
return err;
16471649
}
16481650

0 commit comments

Comments
 (0)