Skip to content

Commit 0b406a4

Browse files
committed
tls: adjust recv return with async crypto and failed copy to userspace
jira VULN-136507 cve-pre CVE-2025-39682 commit-author Sabrina Dubroca <sd@queasysnail.net> commit 85eef9a process_rx_list may not copy as many bytes as we want to the userspace buffer, for example in case we hit an EFAULT during the copy. If this happens, we should only count the bytes that were actually copied, which may be 0. Subtracting async_copy_bytes is correct in both peek and !peek cases, because decrypted == async_copy_bytes + peeked for the peek case: peek is always !ZC, and we can go through either the sync or async path. In the async case, we add chunk to both decrypted and async_copy_bytes. In the sync case, we add chunk to both decrypted and peeked. I missed that in commit 6caaf10 ("tls: fix peeking with sync+async decryption"). Fixes: 4d42cd6 ("tls: rx: fix return value for async crypto") Signed-off-by: Sabrina Dubroca <sd@queasysnail.net> Reviewed-by: Simon Horman <horms@kernel.org> Link: https://lore.kernel.org/r/1b5a1eaab3c088a9dd5d9f1059ceecd7afe888d1.1711120964.git.sd@queasysnail.net Signed-off-by: Jakub Kicinski <kuba@kernel.org> (cherry picked from commit 85eef9a) Signed-off-by: Brett Mastbergen <bmastbergen@ciq.com>
1 parent f460d1f commit 0b406a4

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

net/tls/tls_sw.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2117,6 +2117,9 @@ int tls_sw_recvmsg(struct sock *sk,
21172117
else
21182118
err = process_rx_list(ctx, msg, &control, 0,
21192119
async_copy_bytes, is_peek, NULL);
2120+
2121+
/* we could have copied less than we wanted, and possibly nothing */
2122+
decrypted += max(err, 0) - async_copy_bytes;
21202123
}
21212124

21222125
copied += decrypted;

0 commit comments

Comments
 (0)