linux-stable/net
Jakub Kicinski c09dd3773b tls: fix handling of zero-length records on the rx_list
commit 62708b9452 upstream.

Each recvmsg() call must process either
 - only contiguous DATA records (any number of them)
 - one non-DATA record

If the next record has different type than what has already been
processed we break out of the main processing loop. If the record
has already been decrypted (which may be the case for TLS 1.3 where
we don't know type until decryption) we queue the pending record
to the rx_list. Next recvmsg() will pick it up from there.

Queuing the skb to rx_list after zero-copy decrypt is not possible,
since in that case we decrypted directly to the user space buffer,
and we don't have an skb to queue (darg.skb points to the ciphertext
skb for access to metadata like length).

Only data records are allowed zero-copy, and we break the processing
loop after each non-data record. So we should never zero-copy and
then find out that the record type has changed. The corner case
we missed is when the initial record comes from rx_list, and it's
zero length.

Reported-by: Muhammad Alifa Ramdhan <ramdhan@starlabs.sg>
Reported-by: Billy Jheng Bing-Jhong <billy@starlabs.sg>
Fixes: 84c61fe1a7 ("tls: rx: do not use the standard strparser")
Reviewed-by: Sabrina Dubroca <sd@queasysnail.net>
Link: https://patch.msgid.link/20250820021952.143068-1-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-08-28 16:28:46 +02:00
..
6lowpan
9p
802
8021q net: vlan: fix VLAN 0 refcount imbalance of toggling filtering during runtime 2025-07-24 08:53:19 +02:00
appletalk net: appletalk: Fix use-after-free in AARP proxy probe 2025-08-01 09:47:29 +01:00
atm atm: clip: Fix NULL pointer dereference in vcc_sendmsg() 2025-07-17 18:35:11 +02:00
ax25
batman-adv
bluetooth Bluetooth: hci_sock: Reset cookie to zero in hci_sock_free_cookie() 2025-08-28 16:28:19 +02:00
bpf
bpfilter
bridge net: bridge: Do not offload IGMP/MLD messages 2025-07-24 08:53:19 +02:00
caif caif: reduce stack size, again 2025-08-15 12:08:45 +02:00
can
ceph
core net: better track kernel sockets lifetime 2025-08-28 16:28:39 +02:00
dcb
dccp
devlink
dns_resolver
dsa
ethernet
ethtool
handshake
hsr net, hsr: reject HSR frame if skb can't hold tag 2025-08-28 16:28:39 +02:00
ieee802154
ife
ipv4 net: ipv4: fix incorrect MTU in broadcast routes 2025-08-28 16:28:20 +02:00
ipv6 ipv6: sr: Fix MAC comparison to be constant-time 2025-08-28 16:28:39 +02:00
iucv
kcm
key
l2tp
l3mdev
lapb
llc
mac80211 wifi: mac80211: check basic rates validity in sta_link_apply_parameters 2025-08-28 16:28:41 +02:00
mac802154
mctp net: mctp: Prevent duplicate binds 2025-08-28 16:28:20 +02:00
mpls mpls: Use rcu_dereference_rtnl() in mpls_route_input_rcu(). 2025-06-27 11:09:02 +01:00
mptcp mptcp: disable add_addr retransmission when timeout is 0 2025-08-28 16:28:44 +02:00
ncsi net: ncsi: Fix buffer overflow in fetching version id 2025-08-28 16:28:24 +02:00
netfilter netfilter: ctnetlink: fix refcount leak on table dump 2025-08-28 16:28:14 +02:00
netlabel calipso: unlock rcu before returning -EAFNOSUPPORT 2025-06-19 15:28:46 +02:00
netlink net: better track kernel sockets lifetime 2025-08-28 16:28:39 +02:00
netrom
nfc NFC: nci: uart: Set tty->disc_data only in success path 2025-06-27 11:08:48 +01:00
nsh
openvswitch
packet net/packet: fix a race in packet_set_ring() and packet_notifier() 2025-08-15 12:09:05 +02:00
phonet phonet/pep: Move call to pn_skb_get_dst_sockaddr() earlier in pep_sock_accept() 2025-07-24 08:53:12 +02:00
psample
qrtr
rds net: better track kernel sockets lifetime 2025-08-28 16:28:39 +02:00
rfkill
rose rose: fix dangling neighbour pointers in rose_rt_device_down() 2025-07-10 16:03:11 +02:00
rxrpc rxrpc: Fix transmission of an abort in response to an abort 2025-07-24 08:53:20 +02:00
sched net/sched: ets: use old 'nbands' while purging unused classes 2025-08-28 16:28:40 +02:00
sctp sctp: linearize cloned gso packets in sctp_rcv 2025-08-28 16:28:14 +02:00
smc net: better track kernel sockets lifetime 2025-08-28 16:28:39 +02:00
strparser
sunrpc net: better track kernel sockets lifetime 2025-08-28 16:28:39 +02:00
switchdev
tipc tipc: Fix use-after-free in tipc_conn_close(). 2025-07-17 18:35:09 +02:00
tls tls: fix handling of zero-length records on the rx_list 2025-08-28 16:28:46 +02:00
unix af_unix: Don't set -ECONNRESET for consumed OOB skb. 2025-07-06 11:00:12 +02:00
vmw_vsock vsock/virtio: Validate length in packet header before skb_put() 2025-08-28 16:28:36 +02:00
wireless wifi: cfg80211: reject HTC bit for management frames 2025-08-28 16:28:20 +02:00
x25
xdp
xfrm xfrm: Duplicate SPI Handling 2025-08-28 16:28:22 +02:00
compat.c
devres.c
Kconfig
Kconfig.debug
Makefile
socket.c
sysctl_net.c