* [PATCH net] gtp: don't account echo responses to the ingress device
@ 2026-12-01 8:08 Kyuwon Cho
0 siblings, 0 replies; only message in thread
From: Kyuwon Cho @ 2026-12-01 8:08 UTC (permalink / raw)
To: Pablo Neira Ayuso, Harald Welte
Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Wojciech Drewek, osmocom-net-gprs, netdev
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
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-12-01 8:08 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-01 8:08 [PATCH net] gtp: don't account echo responses to the ingress device Kyuwon Cho
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox