]> git.ipfire.org Git - thirdparty/linux.git/commit
net: Avoid checksumming unreadable skb tail on trim
authorBjörn Töpel <bjorn@kernel.org>
Fri, 22 May 2026 12:06:40 +0000 (14:06 +0200)
committerPaolo Abeni <pabeni@redhat.com>
Tue, 26 May 2026 13:21:27 +0000 (15:21 +0200)
commit2e357f002c61fd76fd8f12468744a06a5ec48eaa
tree36ce8cd717363842ac32ddd85ef49973d01f6476
parent364c2fdacf1ab2e1568277d509c9d86f4e52ca26
net: Avoid checksumming unreadable skb tail on trim

pskb_trim_rcsum_slow() keeps CHECKSUM_COMPLETE valid by subtracting
the checksum of the bytes removed from the skb tail. That assumes the
removed bytes can be read.

io_uring zcrx skbs may contain unreadable net_iov frags. With fbnic
header/data split, small TCP/IPv4 packets can carry Ethernet padding
in such a frag. ip_rcv_core() trims the skb to iph->tot_len before TCP
sees it, and the CHECKSUM_COMPLETE adjustment then calls
skb_checksum() on the padding.

This is exposed by IPv4 because small TCP/IPv4 frames can be shorter
than the Ethernet minimum payload. TCP/IPv6 frames are large enough in
the normal zcrx path, so they do not hit the same padding trim.

Keep the existing checksum adjustment for readable skbs. If the
remaining packet is fully linear, drop CHECKSUM_COMPLETE and let the
stack validate the packet after trimming. If unreadable payload would
remain, fail the trim; the checksum cannot be adjusted without reading
the trimmed tail.

Also clear skb->unreadable when trimming removes all frags.

Fixes: 65249feb6b3d ("net: add support for skbs with unreadable frags")
Signed-off-by: Björn Töpel <bjorn@kernel.org>
Reviewed-by: Breno Leitao <leitao@debian.org>
Link: https://patch.msgid.link/20260522120643.242974-1-bjorn@kernel.org
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
net/core/skbuff.c