linux-yocto/net
Hyunwoo Kim 12401fcfb0 net: skbuff: propagate shared-frag marker through frag-transfer helpers
commit 48f6a5356a33dd78e7144ae1faef95ffc990aae0 upstream.

Two frag-transfer helpers (__pskb_copy_fclone() and skb_shift()) fail
to propagate the SKBFL_SHARED_FRAG bit in skb_shinfo()->flags when
moving frags from source to destination.  __pskb_copy_fclone() defers
the rest of the shinfo metadata to skb_copy_header() after copying
frag descriptors, but that helper only carries over gso_{size,segs,
type} and never touches skb_shinfo()->flags; skb_shift() moves frag
descriptors directly and leaves flags untouched.  As a result, the
destination skb keeps a reference to the same externally-owned or
page-cache-backed pages while reporting skb_has_shared_frag() as
false.

The mismatch is harmful in any in-place writer that uses
skb_has_shared_frag() to decide whether shared pages must be detoured
through skb_cow_data().  ESP input is one such writer (esp4.c,
esp6.c), and a single nft 'dup to <local>' rule -- or any other
nf_dup_ipv4() / xt_TEE caller -- is enough to land a pskb_copy()'d
skb in esp_input() with the marker stripped, letting an unprivileged
user write into the page cache of a root-owned read-only file via
authencesn-ESN stray writes.

Set SKBFL_SHARED_FRAG on the destination whenever frag descriptors
were actually moved from the source.  skb_copy() and skb_copy_expand()
share skb_copy_header() too but linearize all paged data into freshly
allocated head storage and emerge with nr_frags == 0, so
skb_has_shared_frag() returns false on its own; they need no change.

The same omission exists in skb_gro_receive() and skb_gro_receive_list().
The former moves the incoming skb's frag descriptors into the
accumulator's last sub-skb via two paths (a direct frag-move loop and
the head_frag + memcpy path); the latter chains the incoming skb whole
onto p's frag_list.  Downstream skb_segment() reads only
skb_shinfo(p)->flags, and skb_segment_list() reuses each sub-skb's
shinfo as the nskb -- both p and lp must carry the marker.

The same omission also exists in tcp_clone_payload(), which builds an
MTU probe skb by moving frag descriptors from skbs on sk_write_queue
into a freshly allocated nskb.  The helper falls into the same family
and warrants the same fix for consistency; no TCP TX-side in-place
writer is currently known to reach a user page through this gap, but
a future consumer depending on the marker would regress silently.

The same omission exists in skb_segment(): the per-iteration flag
merge takes only head_skb's flag, and the inner switch that rebinds
frag_skb to list_skb on head_skb-frags exhaustion does not fold the
new frag_skb's flag into nskb.  Fold frag_skb's flag at both sites
so segments drawing frags from frag_list members carry the marker.

Fixes: cef401de7b ("net: fix possible wrong checksum generation")
Fixes: f4c50a4034e6 ("xfrm: esp: avoid in-place decrypt on shared skb frags")
Suggested-by: Sabrina Dubroca <sd@queasysnail.net>
Suggested-by: Sultan Alsawaf <sultan@kerneltoast.com>
Suggested-by: Ben Hutchings <ben@decadent.org.uk>
Suggested-by: Lin Ma <malin89@huawei.com>
Suggested-by: Jingguo Tan <tanjingguo@huawei.com>
Suggested-by: Aaron Esau <aaron1esau@gmail.com>
Cc: stable@vger.kernel.org
Signed-off-by: Hyunwoo Kim <imv4bel@gmail.com>
Tested-by: Rajat Gupta <rajat.gupta@oss.qualcomm.com>
Link: https://patch.msgid.link/ageeJfJHwgzmKXbh@v4bel
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
[bwh: Backported to 6.1:
 - skb_gro_receive_list() is in net/ipv4/udp_offload.c here
 - Drop change to tcp_clone_payload(), which does not exist here
]
Signed-off-by: Ben Hutchings <benh@debian.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2026-05-23 13:41:18 +02:00
..
6lowpan
9p xen: make remove callback of xen driver void returned 2026-02-06 16:44:18 +01:00
802 net: 802: LLC+SNAP OID:PID lookup on start of skb data 2025-01-17 13:34:38 +01:00
8021q net: vlan: sync VLAN features with lower device 2025-12-07 06:12:29 +09:00
appletalk net: appletalk: Fix use-after-free in AARP proxy probe 2025-08-15 12:04:47 +02:00
atm atm: lec: fix use-after-free in sock_def_readable() 2026-04-11 14:16:18 +02:00
ax25 ax25: properly unshare skbs in ax25_kiss_rcv() 2025-09-09 18:54:16 +02:00
batman-adv batman-adv: hold claim backbone gateways by reference 2026-04-18 10:35:58 +02:00
bluetooth Bluetooth: eir: Fix possible crashes on eir_create_adv_data 2026-04-11 14:16:38 +02:00
bpf bpf: Do not let BPF test infra emit invalid GSO types to stack 2026-02-06 16:44:14 +01:00
bpfilter
bridge bridge: br_nd_send: validate ND option lengths 2026-04-11 14:16:31 +02:00
caif caif: fix integer underflow in cffrml_receive() 2026-01-11 15:18:42 +01:00
can can: gw: fix OOB heap access in cgw_csum_crc8_rel() 2026-04-11 14:16:13 +02:00
ceph libceph: admit message frames only in CEPH_CON_S_OPEN state 2026-03-25 11:03:08 +01:00
core net: skbuff: propagate shared-frag marker through frag-transfer helpers 2026-05-23 13:41:18 +02:00
dcb net: dcb: choose correct policy to parse DCB_ATTR_BCN 2023-08-11 12:08:17 +02:00
dccp net: fix data-races around sk->sk_forward_alloc 2025-01-23 17:17:17 +01:00
devlink devlink: rate: Unset parent pointer in devl_rate_nodes_destroy 2026-02-19 16:25:19 +01:00
dns_resolver keys, dns: Fix size check of V1 server-list header 2024-01-25 15:27:38 -08:00
dsa net: dsa: improve shutdown sequence 2026-03-25 11:03:18 +01:00
ethernet ethernet: Extend device_get_mac_address() to use NVMEM 2025-12-07 06:12:24 +09:00
ethtool net: ethtool: fix the error condition in ethtool_get_phy_stats_ethtool() 2026-01-11 15:19:27 +01:00
hsr net: hsr: fix VLAN add unwind on slave errors 2026-04-11 14:16:24 +02:00
ieee802154 net: ieee802154: do not leave a dangling sk pointer in ieee802154_create() 2024-12-14 19:54:41 +01:00
ife net: sched: ife: fix potential use-after-free 2024-01-01 12:38:56 +00:00
ipv4 net: skbuff: propagate shared-frag marker through frag-transfer helpers 2026-05-23 13:41:18 +02:00
ipv6 xfrm: esp: avoid in-place decrypt on shared skb frags 2026-05-08 12:48:33 +02:00
iucv s390/iucv: MSG_PEEK causes memory leak in iucv_sock_destruct() 2024-12-14 19:53:50 +01:00
kcm kcm: Serialise kcm_sendmsg() for the same socket. 2024-08-29 17:30:44 +02:00
key af_key: validate families in pfkey_send_migrate() 2026-04-11 14:16:05 +02:00
l2tp l2tp: do not use sock_hold() in pppol2tp_session_get_sock() 2026-03-25 11:03:11 +01:00
l3mdev
lapb
llc llc: fix data loss when reading from a socket in llc_ui_recvmsg() 2025-06-04 14:40:21 +02:00
mac80211 wifi: mac80211: fix NULL deref in mesh_matches_local() 2026-03-25 11:03:22 +01:00
mac802154 mac802154: check local interfaces before deleting sdata list 2025-01-23 17:17:11 +01:00
mctp mctp: route: hold key->lock in mctp_flow_prepare_output() 2026-03-25 11:03:04 +01:00
mpls mpls: Use rcu_dereference_rtnl() in mpls_route_input_rcu(). 2025-06-27 11:07:39 +01:00
mptcp Revert "mptcp: add needs_id for netlink appending addr" 2026-04-18 10:35:57 +02:00
ncsi net: ncsi: fix skb leak in error paths 2026-03-25 11:03:09 +01:00
netfilter netfilter: nft_ct: fix use-after-free in timeout object destroy 2026-04-18 10:35:57 +02:00
netlabel calipso: unlock rcu before returning -EAFNOSUPPORT 2025-06-27 11:07:25 +01:00
netlink netlink: avoid infinite retry looping in netlink_unicast() 2025-08-28 16:25:48 +02:00
netrom netrom: fix double-free in nr_route_frame() 2026-02-06 16:44:13 +01:00
nfc nfc: nci: fix circular locking dependency in nci_close_device 2026-04-11 14:16:06 +02:00
nsh nsh: Restore skb->{protocol,data,mac_header} for outer header in nsh_gso_segment(). 2024-05-17 11:55:59 +02:00
openvswitch openvswitch: validate MPLS set/set_masked payload length 2026-04-11 14:16:07 +02:00
packet net: fix fanout UAF in packet_release() via NETDEV_UP race 2026-04-11 14:16:07 +02:00
phonet phonet/pep: Move call to pn_skb_get_dst_sockaddr() earlier in pep_sock_accept() 2025-07-24 08:51:48 +02:00
psample psample: Require 'CAP_NET_ADMIN' when joining "packets" group 2023-12-13 18:39:11 +01:00
qrtr net: qrtr: replace qrtr_tx_flow radix_tree with xarray to fix memory leak 2026-04-11 14:16:19 +02:00
rds rds: ib: reject FRMR registration before IB connection is established 2026-04-11 14:16:23 +02:00
rfkill net: rfkill: prevent unlimited numbers of rfkill events from being created 2026-04-18 10:35:57 +02:00
rose net/rose: fix NULL pointer dereference in rose_transmit_link on reconnect 2026-03-25 11:03:20 +01:00
rxrpc rxrpc: Fix key/keyring checks in setsockopt(RXRPC_SECURITY_KEY/KEYRING) 2026-04-18 10:35:59 +02:00
sched net/sched: cls_flow: fix NULL pointer dereference on shared blocks 2026-04-11 14:16:24 +02:00
sctp sctp: linearize cloned gso packets in sctp_rcv 2026-02-06 16:44:24 +01:00
smc net/smc: fix double-free of smc_spd_priv when tee() duplicates splice pipe buffer 2026-04-11 14:16:07 +02:00
strparser strparser: Fix signed/unsigned mismatch bug 2025-12-07 06:12:35 +09:00
sunrpc sunrpc: fix cache_request leak in cache_release 2026-03-25 11:03:12 +01:00
switchdev net: switchdev: Convert blocking notification chain to a raw one 2025-03-28 21:58:49 +01:00
tipc tipc: fix bc_ackers underflow on duplicate GRP_ACK_MSG 2026-04-18 10:35:58 +02:00
tls net/tls: fix use-after-free in -EBUSY error path of tls_do_encryption 2026-04-18 10:35:58 +02:00
unix af_unix: Initialise scc_index in unix_add_edge(). 2025-12-07 06:12:32 +09:00
vmw_vsock vmw_vsock: bypass false-positive Wnonnull warning with gcc-16 2026-03-04 07:20:29 -05:00
wireless wifi: cfg80211: cancel pmsr_free_wk in cfg80211_pmsr_wdev_down 2026-03-25 11:03:20 +01:00
x25 net/x25: Fix overflow when accumulating packets 2026-04-11 14:16:24 +02:00
xdp xsk: Fix race condition in AF_XDP generic RX path 2026-02-19 16:25:19 +01:00
xfrm xfrm: clear trailing padding in build_polexpire() 2026-04-18 10:35:58 +02:00
compat.c
devres.c
Kconfig
Kconfig.debug
Makefile af_unix: Remove CONFIG_UNIX_SCM. 2025-06-04 14:40:23 +02:00
socket.c net: Remove RTNL dance for SIOCBRADDIF and SIOCBRDELIF. 2026-01-11 15:19:23 +01:00
sysctl_net.c sysctl: treewide: drop unused argument ctl_table_root::set_ownership(table) 2024-08-11 12:35:51 +02:00