From: netdev-bot+sashiko@kernel.org
To: littlesmilingcloud@gmail.com
Cc: netdev@vger.kernel.org, edumazet@kernel.org, kuba@kernel.org,
pabeni@redhat.com, davem@davemloft.net, horms@kernel.org,
dsahern@kernel.org, willemb@google.com, idosch@nvidia.com,
fw@strlen.de, u9012063@gmail.com, mvohra@vmware.com,
matthias.may@westermo.com, mazin@getstate.dev, shuah@kernel.org,
linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next v8 3/5] ip6_gre: classify the inner packet once on transmit
Date: Thu, 03 Dec 2026 12:39:01 +0000 [thread overview]
Message-ID: <179630154116.3146.4207161011188835860@kernel.org> (raw)
In-Reply-To: <20261202123613.1708463-4-littlesmilingcloud@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 0
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [Medium] In this commit, ip6erspan_tunnel_xmit() (net/ipv6/ip6_gre.c)
passes the classified payload_protocol only to ip6_tnl_xmit() (line…
--
ip6_gre: classify the inner packet once on transmit
This commit adds ip6gre_xmit_classify(). It works out the inner protocol
once, on entry to ip6gre_tunnel_xmit() and ip6erspan_tunnel_xmit(). On
Ethernet devices it looks through VLAN tags and pulls the inner IP header.
The result is passed down to ip6_tnl_xmit() as a new payload_protocol
argument. That replaces the skb_protocol(skb, true) calls, which parsed the
frame again after the GRE and ERSPAN headers were pushed.
Closes: https://syzkaller.appspot.com/bug?extid=6023ea32e206eef7920a
> diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c
> index 51f4311bebfa4..c413e47c6ceb0 100644
> --- a/net/ipv6/ip6_gre.c
> +++ b/net/ipv6/ip6_gre.c
[ ... ]
> @@ -950,7 +1005,7 @@ static netdev_tx_t ip6erspan_tunnel_xmit(struct sk_buff *skb,
> __u32 mtu;
> int nhoff;
>
> - if (!pskb_inet_may_pull(skb))
> + if (ip6gre_xmit_classify(skb, dev, &payload_protocol))
> goto tx_err;
>
> if (!ip6_tnl_xmit_ctl(t, &t->parms.laddr, &t->parms.raddr))
[ ... ]
> @@ -1073,7 +1128,7 @@ static netdev_tx_t ip6erspan_tunnel_xmit(struct sk_buff *skb,
> htonl(atomic_fetch_inc(&t->o_seqno)));
>
> err = ip6_tnl_xmit(skb, dev, dsfield, &fl6, encap_limit, &mtu,
> - NEXTHDR_GRE);
> + NEXTHDR_GRE, payload_protocol);
> if (err != 0) {
> /* XXX: send ICMP error even if DF is not set. */
> if (err == -EMSGSIZE) {
[Severity: Medium]
payload_protocol is passed to ip6_tnl_xmit() here. Does the rest of
ip6erspan_tunnel_xmit() still go by skb->protocol? In this commit the
truncate checks, the native mode dispatch and the choice of ICMP family
are unchanged:
net/ipv6/ip6_gre.c:ip6erspan_tunnel_xmit() {
...
nhoff = skb_network_offset(skb);
if (skb->protocol == htons(ETH_P_IP) &&
(ntohs(ip_hdr(skb)->tot_len) > skb->len - nhoff))
truncate = true;
if (skb->protocol == htons(ETH_P_IPV6)) {
...
} else {
switch (skb->protocol) {
case htons(ETH_P_IP):
...
if (err == -EMSGSIZE) {
if (skb->protocol == htons(ETH_P_IP))
icmp_ndo_send(skb, ICMP_DEST_UNREACH,
ICMP_FRAG_NEEDED, htonl(mtu));
else
icmpv6_ndo_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu);
...
}
ip6_tnl_xmit() now takes payload_protocol as an argument, but its MTU
floor still checks skb->protocol:
net/ipv6/ip6_tunnel.c:ip6_tnl_xmit() {
...
mtu = max(mtu, skb->protocol == htons(ETH_P_IPV6) ?
IPV6_MIN_MTU : IPV4_MIN_MTU);
...
}
Take a VLAN-tagged IPv4 or IPv6 frame on a native ip6erspan device.
ip6gre_xmit_classify() sets payload_protocol to ETH_P_IP or ETH_P_IPV6, so
the hop limit is inherited from the inner header.
The switch on skb->protocol still takes the default branch, though. That
skips prepare_ip6gre_xmit_ipv4() and prepare_ip6gre_xmit_ipv6(), so the
traffic class, flow label and encap_limit do not come from the inner
header. The truncate bit is not set from the inner length either.
On -EMSGSIZE, a tagged IPv4 frame would be passed to icmpv6_ndo_send()
with an IPv4 header at the network header. icmp6_send() bounds-checks that
read, so the result is a bogus PKT_TOOBIG, not memory corruption.
These sites behaved the same way before this patch. Even so, the
behaviour doesn't seem to match the new comment above
ip6gre_xmit_classify():
Nothing below parses the frame again: the answer is passed down, also to
ip6_tnl_xmit().
The next patch in the series, "ip6_gre: go by the inner protocol behind
VLAN tags in ip6erspan", appears to switch all four sites to
payload_protocol and to send icmpv6_ndo_send() only for ETH_P_IPV6. Could
that change be folded into this one? If not, could the comment and the
commit message be adjusted so this commit is accurate on its own?
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261202123613.1708463-1-littlesmilingcloud%40gmail.com
next prev parent reply other threads:[~2026-12-03 12:39 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-02 12:36 [PATCH net-next v8 0/5] ip6_gre, erspan: fix inner header handling for VLAN-tagged and short frames Anton Danilov
2026-12-02 12:36 ` [PATCH net-next v8 1/5] erspan: bound the VLAN tag read in erspan_build_header{,_v2}() Anton Danilov
2026-12-02 12:36 ` [PATCH net-next v8 2/5] erspan: take the COS from the mirrored frame, not from the tunnel family Anton Danilov
2026-12-03 12:38 ` netdev-bot+sashiko
2026-12-02 12:36 ` [PATCH net-next v8 3/5] ip6_gre: classify the inner packet once on transmit Anton Danilov
2026-12-03 12:39 ` netdev-bot+sashiko [this message]
2026-12-02 12:36 ` [PATCH net-next v8 4/5] ip6_gre: go by the inner protocol behind VLAN tags in ip6erspan Anton Danilov
2026-12-03 12:39 ` netdev-bot+sashiko
2026-12-02 12:36 ` [PATCH net-next v8 5/5] selftests: net: add a test for ip6gretap and ip6erspan with VLAN tags Anton Danilov
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=179630154116.3146.4207161011188835860@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@kernel.org \
--cc=fw@strlen.de \
--cc=horms@kernel.org \
--cc=idosch@nvidia.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=littlesmilingcloud@gmail.com \
--cc=matthias.may@westermo.com \
--cc=mazin@getstate.dev \
--cc=mvohra@vmware.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=shuah@kernel.org \
--cc=u9012063@gmail.com \
--cc=willemb@google.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