linux/net
Sun Jian 33f2b2eb33 net: fix skb length accounting after generic XDP frag adjustment
Generic XDP exposes non-linear skb fragments through an xdp_buff. If an
XDP program adjusts the fragment area, bpf_prog_run_generic_xdp() copies
xdp_frags_size back to skb->data_len but leaves skb->len containing the
old fragment contribution.

After a fragment shrink, this makes skb_headlen() larger than the actual
linear area. In the reproduced UDP receive path, __skb_datagram_iter()
copied 1024 bytes past the actual linear tail to userspace, starting at
struct skb_shared_info. The copied bytes included the affected skb's
nr_frags, xdp_frags_size and a kernel pointer from
skb_shinfo(skb)->frags[0]. Real packet data was displaced by the same
amount and truncated at the end.

Subtract the old data_len before replacing it and add the new data_len
afterwards, keeping skb->len and skb->data_len synchronized.

A 60000-byte UDP datagram on a veth pair with MTU 64000 was shortened by
1024 bytes from its fragment area. Before the fix, all 10 runs produced
corrupted payloads. After the fix, all 10 runs matched the expected
payload exactly.

Fixes: e6d5dbdd20 ("xdp: add multi-buff support for xdp running in generic mode")
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/bpf/al9T9Eto%2FhRIzP5W@boxer/
Reviewed-by: Mohsin Bashir <hmohsin@meta.com>
Acked-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Sun Jian <sun.jian.kdev@gmail.com>
Link: https://patch.msgid.link/20260804054040.613675-2-sun.jian.kdev@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-08-07 17:01:05 -07:00
..
6lowpan 6lowpan: fix NHC entry use-after-free on error path 2026-06-11 15:27:07 -07:00
9p 9p: Add missing read barrier in virtio zero-copy path 2026-06-21 05:22:57 +00:00
802 appletalk: move the protocol out of tree 2026-06-16 14:37:06 -07:00
8021q vlan: defer real device state propagation to netdev_work 2026-06-25 10:18:40 -07:00
atm net/atm: fix slab-out-of-bounds read in vcc_setsockopt() 2026-08-06 09:29:14 -07:00
batman-adv batman-adv: dat: fix tie-break for candidate selection 2026-07-06 07:18:59 +02:00
bluetooth Bluetooth: SCO: give the socket its own sco_conn reference 2026-07-28 16:13:48 -04:00
bpf bpf: Fix partial copy of non-linear test_run output 2026-06-21 17:55:06 -07:00
bridge Merge git://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf 2026-08-05 16:23:34 -07:00
can can: isotp: check register_netdevice_notifier() error in module init 2026-07-29 11:26:41 +02:00
ceph libceph: bound pg_{temp,upmap,upmap_items} length to CEPH_PG_MAX_SIZE 2026-07-23 20:29:42 +02:00
core net: fix skb length accounting after generic XDP frag adjustment 2026-08-07 17:01:05 -07:00
dcb
devlink devlink: fix net namespace reference leak in reload 2026-07-31 18:23:44 -07:00
dns_resolver net/dns_resolver: use kasprintf + kmemdup_nul to simplify dns_query 2026-06-04 18:39:29 -07:00
dsa net: dsa: Fix skb ownership in taggers 2026-06-27 15:44:12 -07:00
ethernet
ethtool ethtool: rss: Fix hfunc and input_xfrm parsing on big endian 2026-07-09 11:38:30 +02:00
handshake handshake: Require admin permission for DONE command 2026-06-12 15:45:44 -07:00
hsr net: hsr: fix memory leak on slave unregistration by removing synced VLANs 2026-07-22 10:24:44 -07:00
ieee802154 ieee802154: allow legacy LLSEC ADD/DEL ops to pass strict validation 2026-06-19 23:02:42 +02:00
ife net: ife: require ETH_HLEN to be pullable in ife_decode() 2026-06-13 17:34:39 -07:00
ipv4 tcp: fix TFO max_qlen accounting across reuseport migration 2026-08-05 17:10:28 -07:00
ipv6 ip6_tunnel: clear skb2->cb[] in ip6ip6_err() 2026-08-05 17:30:38 -07:00
iucv net/af_iucv: fix NULL deref in afiucv_hs_callback_syn() 2026-07-21 13:36:35 -07:00
kcm Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2026-06-16 14:59:58 -07:00
key ipsec-2026-06-22 2026-06-23 16:22:24 -07:00
l2tp Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2026-06-04 15:29:04 -07:00
l3mdev
lapb
llc llc: fix SAP refcount leak when creating incoming sockets 2026-07-17 13:17:46 +02:00
mac80211 wifi: mac80211: validate individual TWT params before driver setup 2026-07-28 15:34:31 +02:00
mac802154 mac802154: fix netdev use-after-free in beacon worker 2026-08-05 17:12:50 -07:00
mctp mctp: check register_netdevice_notifier() error in mctp_device_init() 2026-07-23 09:17:36 -07:00
mpls net: mpls: initialize rtm_tos in mpls_getroute() 2026-07-28 11:06:06 +02:00
mptcp mptcp: reclaim forward-allocated memory on RX path errors 2026-08-06 08:46:24 -07:00
ncsi net/ncsi: fix heap OOB read in NCSI_CMD_SEND_CMD payload length 2026-08-05 17:24:57 -07:00
netfilter netfilter: nf_flow_table: drop existing skb dst before skb_dst_set_noref() 2026-08-05 17:11:18 -07:00
netlabel Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2026-06-11 14:33:35 -07:00
netlink Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2026-05-28 14:02:21 -07:00
nfc nfc: nci: uart: Constify struct tty_ldisc_ops 2026-06-11 20:21:32 +02:00
nsh
openvswitch net: openvswitch: reallocate update replies for mismatched IDs 2026-08-04 18:19:50 -07:00
packet packet: use consistent hard_header_len in TX_RING send path 2026-08-06 09:27:21 -07:00
phonet phonet: check register_netdevice_notifier() error in phonet_device_init() 2026-07-23 10:28:50 -07:00
psample net: psample: fix info leak in PSAMPLE_ATTR_DATA 2026-06-17 16:35:50 -07:00
psp psp: fix NULL genl_sock deref race with concurrent netns teardown 2026-07-29 16:48:16 -07:00
qrtr net: qrtr: ns: Raise lookup limit to 128 2026-08-06 08:10:44 -07:00
rds rds: tcp: hold the RCU lock across ipv6_chk_addr() in rds_tcp_laddr_check() 2026-07-23 14:11:37 -07:00
rfkill Replace <linux/mod_devicetable.h> by more specific <linux/device-id/*.h> (c files) 2026-07-03 07:38:17 +02:00
rxrpc rxrpc: fix io_thread race in rxrpc_wake_up_io_thread() 2026-07-21 11:52:29 +02:00
sched net/sched: reject overly deep qdisc hierarchies 2026-08-06 15:24:44 +02:00
sctp sctp: validate cookie AUTH state before use 2026-08-07 15:02:32 -07:00
shaper net: shaper: add a note that we expect cap dumps to be tiny 2026-06-11 12:55:23 +02:00
smc net/smc: fix TOCTOU race between smc_listen_out() and listener close 2026-08-06 13:35:41 +02:00
strparser
sunrpc SUNRPC: pin upper rpc_clnt across the TLS connect_worker 2026-07-08 14:07:19 -04:00
switchdev
tipc tipc: avoid use-after-free in poll trace queue dumps 2026-07-27 15:18:59 -07:00
tls tls: don't abort the connection on signal-interrupted sends 2026-08-06 09:38:20 -07:00
unix af_unix: Unlink scc_entry in unix_del_edge(). 2026-08-06 11:52:48 -07:00
vmw_vsock vsock/virtio: avoid refilling the RX queue after teardown 2026-08-03 16:28:58 -07:00
wireless wifi: cfg80211: publish PMSR request before starting the driver 2026-07-28 15:08:57 +02:00
x25 net/x25: fix use-after-free of the socket by its timers 2026-07-30 18:46:45 -07:00
xdp xsk: validate metadata when processing requests 2026-08-03 16:43:54 -07:00
xfrm xfrm: policy: preallocate inexact bins before xfrm_hash_rebuild reinsert 2026-07-06 08:30:02 +02:00
compat.c net: Remove support for AIO on sockets 2026-05-29 14:05:30 +08:00
devres.c
Kconfig appletalk: move the protocol out of tree 2026-06-16 14:37:06 -07:00
Kconfig.debug
Makefile appletalk: move the protocol out of tree 2026-06-16 14:37:06 -07:00
socket.c Networking changes for 7.2. 2026-06-17 08:17:00 +01:00
sysctl_net.c