tls: make sure to abort the stream if headers are bogus
Normally we wait for the socket to buffer up the whole record before we service it. If the socket has a tiny buffer, however, we read out the data sooner, to prevent connection stalls. Make sure that we abort the connection when we find out late that the record is actually invalid. Retrying the parsing is fine in itself but since we copy some more data each time before we parse we can overflow the allocated skb space. Constructing a scenario in which we're under pressure without enough data in the socket to parse the length upfront is quite hard. syzbot figured out a way to do this by serving us the header in small OOB sends, and then filling in the recvbuf with a large normal send. Make sure that tls_rx_msg_size() aborts strp, if we reach an invalid record there's really no way to recover. Reported-by:Lee Jones <lee@kernel.org> Fixes: 84c61fe1 ("tls: rx: do not use the standard strparser") Reviewed-by:
Sabrina Dubroca <sd@queasysnail.net> Signed-off-by:
Jakub Kicinski <kuba@kernel.org> Link: https://patch.msgid.link/20250917002814.1743558-1-kuba@kernel.org Signed-off-by:
Paolo Abeni <pabeni@redhat.com>
-
mentioned in commit 1257aa45
-
mentioned in commit 1ebed424
-
mentioned in commit c8e84468
-
mentioned in commit 3cc704aa
-
mentioned in commit 5a3e04d9
-
mentioned in commit 990189f2
-
mentioned in commit 0cc282c6
-
mentioned in commit e2e8d09b
-
mentioned in commit c038c294
-
mentioned in commit 1a71448b
-
mentioned in commit 2403eaec
-
mentioned in commit 6c34fb95
-
mentioned in commit 2aefdc50
-
mentioned in commit c4bcbf92
-
mentioned in commit 3e0578a3
-
mentioned in commit f0c68161
-
mentioned in commit 443be96c
-
mentioned in commit 18a026f7
-
mentioned in commit 41978cd5
-
mentioned in commit 162ecea4
-
mentioned in commit eb97177b
-
mentioned in commit 7ad71a74
-
mentioned in commit e07b65c5
-
mentioned in commit 1b4cf784
-
mentioned in commit eb3ff1eb
-
mentioned in commit b3c8feaf
-
mentioned in commit 3d3ed2ae
-
mentioned in commit e4a8c4f6
-
mentioned in commit ea224cf5
-
mentioned in commit 7d305e58
-
mentioned in commit c5c3b118