Thread View: linux.kernel.netdev
1 messages
1 total messages
Started by Kyuwon Cho
Tue, 01 Dec 2026 08:08
[PATCH net] gtp: don't account echo responses to the ingress device
Author: Kyuwon Cho
Date: Tue, 01 Dec 2026 08:08
Date: Tue, 01 Dec 2026 08:08
66 lines
13246 bytes
13246 bytes
gtp0_send_echo_resp_ip() and gtp1u_send_echo_resp() turn the received
skb into the echo response and pass it to udp_tunnel_xmit_skb() with
skb->dev still set to the device the request arrived on. iptunnel_xmit()
then calls iptunnel_xmit_stats() on that device, which only handles
NETDEV_PCPU_STAT_TSTATS and NETDEV_PCPU_STAT_DSTATS. A request received
on lo, which has NETDEV_PCPU_STAT_LSTATS, hits the WARN_ON_ONCE() there:
WARNING: include/net/ip_tunnels.h:701 at iptunnel_xmit+0x646/0xb50
Call Trace:
<IRQ>
gtp_encap_recv+0x14ae/0x22e0
udp_queue_rcv_one_skb+0x60c/0xc50
udp_unicast_rcv_skb+0xc1/0x2c0
ip_protocol_deliver_rcu+0x1e6/0x360
ip_local_deliver_finish+0x35a/0x5b0
Before commit 8431c602f551 ("ip_tunnel: adapt iptunnel_xmit_stats() to
NETDEV_PCPU_STAT_DSTATS"), iptunnel_xmit_stats() updated dev->tstats of
the ingress device whatever stats type it had. On such kernels, such as
linux-6.1.y, a request received on lo writes 16 bytes past lo's per-CPU
pcpu_lstats.
The response is not traffic of the ingress device. Clear skb->dev before
sending it: iptunnel_xmit() skips the stats update for a NULL skb->dev,
and ip_output() takes the egress device from the route.
Fixes: 9af41cc33471 ("gtp: Implement GTP echo response")
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Kyuwon Cho <kyuwoncho18@gmail.com>
---
The issue was found by an LLM-guided test generator that we are
developing as a research prototype. I sent it privately on 2026-11-18;
it comes to the list now because security-bugs.rst asks for bugs found
with AI assistance to be handled in public. The reproducer creates a
GTP device in its own user and network namespace and sends one GTP-U
echo request to 127.0.0.1:2152; it is available on request.
Reproduced on mainline v7.4-rc5 (fe6ff8d5d675); the patch is against
net (76fca30e8d34), and with it the reproducer runs clean.
drivers/net/gtp.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/net/gtp.c b/drivers/net/gtp.c
index 85d1b0c46ecf..f84a4f37e849 100644
--- a/drivers/net/gtp.c
+++ b/drivers/net/gtp.c
@@ -451,6 +451,7 @@ static int gtp0_send_echo_resp_ip(struct gtp_dev *gtp, struct sk_buff *skb)
return -1;
}
+ skb->dev = NULL;
udp_tunnel_xmit_skb(rt, gtp->sk0, skb,
fl4.saddr, fl4.daddr,
iph->tos,
@@ -714,6 +715,7 @@ static int gtp1u_send_echo_resp(struct gtp_dev *gtp, struct sk_buff *skb)
return -1;
}
+ skb->dev = NULL;
udp_tunnel_xmit_skb(rt, gtp->sk1u, skb,
fl4.saddr, fl4.daddr,
iph->tos,
--
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