From: "dongchenchen (A)" <dongchenchen2@huawei.com>
To: Eric Dumazet <edumazet@google.com>
Cc: <davem@davemloft.net>, <pabeni@redhat.com>, <kuba@kernel.org>,
<horms@kernel.org>, <herbert@gondor.apana.org.au>,
<kuniyu@google.com>, <idosch@nvidia.com>, <andrew+netdev@lunn.ch>,
<ap420073@gmail.com>, <steffen.klassert@secunet.com>,
<laforge@gnumonks.org>, <jiayuan.chen@linux.dev>,
<jhs@mojatatu.com>, <zhangchangzhong@huawei.com>,
<netdev@vger.kernel.org>,
<syzbot+83181a31faf9455499c5@syzkaller.appspotmail.com>
Subject: Re: [PATCH net] net: iptunnel: fix stale transport header during tunnel decapsulation
Date: Fri, 21 Aug 2026 10:30:23 +0800 [thread overview]
Message-ID: <a0d6de47-ec35-4f30-93d5-969a208b7be0@huawei.com> (raw)
In-Reply-To: <f8549a27-8052-4d74-a505-9c0b42c73687@huawei.com>
>
>
>>>>
>>> Hi, Eric. Thanks for the review!
>>>
>>> I missed the rcv path in the commit message.
>>> With an ingress qdisc attached to gtp, the stale transport header
>>> will been consumed in sch_handle_ingress() and its not covered by
>>> gro_cells_receive() either. So maybe gtp is not safe by
>>> construction.
>>>
>>> gtp_encap_rcv
>>> gtp_rx //stale transport header
>>> __netif_rx
>>> __netif_receive_skb_core
>>> sch_handle_ingress
>>> qdisc_pkt_len_segs_init
>>>
>>
>> Let's step back a bit :)
>>
>> For non-GSO packets, qdisc_pkt_len_segs_init() returns immediately:
>>
>> qdisc_skb_cb(skb)->pkt_len = skb->len;
>> if (!shinfo->gso_size) {
>> qdisc_skb_cb(skb)->pkt_segs = 1;
>> return SKB_NOT_DROPPED_YET;
>> }
>>
>> It does not inspect skb->transport_header at all. It will be set
>> eventually later if needed,
>>
>> GTP does not implement GRO on RX and does not use gro_cells, so incoming
>> packets in gtp_rx() have gso_size == 0.
>>
>
> Hi, Eric. Thanks for your patient explanation.
>
> Normal GTP traffic indeed cannot trigger this issue and pkt without
> SKB_GSO_UDP_TUNNEL will be caught by udp_unexpected_gso.
> The only way to reproduce this for gtp is by constructing and injecting
> packets, such as TAP device injects a GSO UDP-tunnel packet (with
> GSO_TCPV4 and GSO_UDP_TUNNEL flag, Ethernet/IPv4/UDP/GTP-U/IPV4/TCP).
> Should we add interception for such illegal pkts?
>
> diff --git a/net/core/dev.c b/net/core/dev.c
> index af260ff5462a..8620428b950f 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -4138,6 +4138,10 @@ static enum skb_drop_reason
> qdisc_pkt_len_segs_init(struct sk_buff *skb)
> if (likely(shinfo->gso_type & (SKB_GSO_TCPV4 | SKB_GSO_TCPV6))) {
> const struct tcphdr *th;
>
> + /* Defensive: stale offsets from buggy tunnel decap can
> underflow. */
> + if (unlikely(hdr_len > INT_MAX))
> + return 0;
> +
Sorry, there is a typo here.
It should be SKB_DROP_REASON_SKB_BAD_GSO.
> if (!pskb_may_pull(skb, hdr_len + sizeof(struct tcphdr)))
> return SKB_DROP_REASON_SKB_BAD_GSO;
>
> -------------
> Best Regards
> Dong Chenchen
>
>> The issue specifically requires GSO packets (shinfo->gso_size != 0),
>> which are
>> processed/aggregated through gro_cells. Fixing this in
>> gro_cells_receive() covers
>> all the relevant tunnel drivers in one place.
>>
>> Thanks.
>
next prev parent reply other threads:[~2026-08-21 2:30 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-13 3:38 [PATCH net] net: iptunnel: fix stale transport header during tunnel decapsulation Dong Chenchen
2026-08-13 4:39 ` Eric Dumazet
2026-08-19 13:11 ` Eric Dumazet
2026-08-20 8:58 ` dongchenchen (A)
2026-08-20 9:16 ` Eric Dumazet
2026-08-20 10:04 ` dongchenchen (A)
2026-08-20 16:32 ` Eric Dumazet
2026-08-21 2:21 ` dongchenchen (A)
2026-08-21 2:30 ` dongchenchen (A) [this message]
2026-08-21 6:23 ` Eric Dumazet
2026-08-21 6:35 ` Eric Dumazet
2026-08-21 9:54 ` dongchenchen (A)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=a0d6de47-ec35-4f30-93d5-969a208b7be0@huawei.com \
--to=dongchenchen2@huawei.com \
--cc=andrew+netdev@lunn.ch \
--cc=ap420073@gmail.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=herbert@gondor.apana.org.au \
--cc=horms@kernel.org \
--cc=idosch@nvidia.com \
--cc=jhs@mojatatu.com \
--cc=jiayuan.chen@linux.dev \
--cc=kuba@kernel.org \
--cc=kuniyu@google.com \
--cc=laforge@gnumonks.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=steffen.klassert@secunet.com \
--cc=syzbot+83181a31faf9455499c5@syzkaller.appspotmail.com \
--cc=zhangchangzhong@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox