Thread View: linux.kernel.netdev
1 messages
1 total messages
Started by Xiang Mei
Sun, 29 Nov 2026 01:48
[PATCH net] udp: unlink GSO segments before per-segment receive
Author: Xiang Mei
Date: Sun, 29 Nov 2026 01:48
Date: Sun, 29 Nov 2026 01:48
76 lines
13458 bytes
13458 bytes
udp_queue_rcv_skb() and udpv6_queue_rcv_skb() split a GSO packet into
segments and pass them on one by one, but each segment still points to
the next one via skb->next. If the receiver sends the skb back out (the
GTP echo responder does), the transmit path sends the whole chain, and
the loop then uses segments it no longer owns:
Oops: general protection fault, ... address 0xdffffc0000000021: ...
KASAN: null-ptr-deref in range [0x0000000000000108-0x000000000000010f]
RIP: 0010:__xfrm_policy_check2.constprop.0 (./include/net/xfrm.h:1311)
Call Trace:
<IRQ>
udpv6_queue_rcv_one_skb (./include/net/xfrm.h:1353 net/ipv6/udp.c:820)
udpv6_queue_rcv_skb (net/ipv6/udp.c:899 net/ipv6/udp.c:885)
udp6_unicast_rcv_skb (net/ipv6/udp.c:1037)
ip6_protocol_deliver_rcu (net/ipv6/ip6_input.c:479)
ip6_input_finish (net/ipv6/ip6_input.c:538)
ip6_input (... net/ipv6/ip6_input.c:549)
ipv6_rcv (... net/ipv6/ip6_input.c:351)
__netif_receive_skb_one_core (net/core/dev.c:6451)
process_backlog (net/core/dev.c:6564 net/core/dev.c:6915)
__napi_poll (net/core/dev.c:8001)
net_rx_action (net/core/dev.c:8064 net/core/dev.c:8221)
handle_softirqs (kernel/softirq.c:669)
do_softirq.part.0 (kernel/softirq.c:569)
</IRQ>
...
__local_bh_enable_ip (kernel/softirq.c:561 kernel/softirq.c:473)
__dev_queue_xmit (... net/core/dev.c:5135)
packet_sendmsg (net/packet/af_packet.c:3177 net/packet/af_packet.c:3209)
__sock_sendmsg (net/socket.c:800 net/socket.c:818)
__sys_sendto (net/socket.c:2283)
__x64_sys_sendto (net/socket.c:2290 net/socket.c:2286)
do_syscall_64 (arch/x86/entry/syscall_64.c:61 arch/x86/entry/syscall_64.c:89)
entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:121)
Kernel panic - not syncing: Fatal exception in interrupt
Clear skb->next before passing each segment on, as the similar segment
loops in ip_finish_output_gso() and ip6_finish_output_gso_slowpath_drop()
already do.
Cc: stable@vger.kernel.org
Fixes: cf329aa42b66 ("udp: cope with UDP GRO packet misdirection")
Reported-by: co+24977a105aa177de@bugs.sh
Signed-off-by: Xiang Mei <xmei5@asu.edu>
---
net/ipv4/udp.c | 1 +
net/ipv6/udp.c | 1 +
2 files changed, 2 insertions(+)
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index 2e5562f353f8..a4cd085e3855 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -2476,6 +2476,7 @@ static int udp_queue_rcv_skb(struct sock *sk, struct sk_buff *skb)
__skb_push(skb, -skb_mac_offset(skb));
segs = udp_rcv_segment(sk, skb, true);
skb_list_walk_safe(segs, skb, next) {
+ skb_mark_not_on_list(skb);
__skb_pull(skb, skb_transport_offset(skb));
udp_post_segment_fix_csum(skb);
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
index a6886a0432f9..fabd097f6a32 100644
--- a/net/ipv6/udp.c
+++ b/net/ipv6/udp.c
@@ -893,6 +893,7 @@ static int udpv6_queue_rcv_skb(struct sock *sk, struct sk_buff *skb)
__skb_push(skb, -skb_mac_offset(skb));
segs = udp_rcv_segment(sk, skb, false);
skb_list_walk_safe(segs, skb, next) {
+ skb_mark_not_on_list(skb);
__skb_pull(skb, skb_transport_offset(skb));
udp_post_segment_fix_csum(skb);
--
2.43.0
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads