All of lore.kernel.org
 help / color / mirror / Atom feed
From: Florian Westphal <fw@strlen.de>
To: Eric Dumazet <edumazet@google.com>
Cc: Mazin Al Haddad <mazin@getstate.dev>,
	davem@davemloft.net, dsahern@kernel.org, kuba@kernel.org,
	pabeni@redhat.com, horms@kernel.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	syzbot+6023ea32e206eef7920a@syzkaller.appspotmail.com
Subject: Re: [PATCH] ip6_tunnel: Fix uninit-value in ip6_tnl_xmit
Date: Mon, 5 Jan 2026 10:26:58 +0100	[thread overview]
Message-ID: <aVuD4kwMyyJlSxIV@strlen.de> (raw)
In-Reply-To: <CANn89iJeh5wCRpiBBBucmJXRdTb=DbOjXTHtEm1rOpvq=dGgvQ@mail.gmail.com>

Eric Dumazet <edumazet@google.com> wrote:

Hi Eric

> > When taking the branch with skb_realloc_headroom, pskb_expand_head is
> > called, as such, pointers referencing content within the new skb's header
> > are invalid. Currently, the assignment of hop_limit accesses the now
> > invalid pointer in the network header of this "new" skb. Fix this by
> > moving the logic to assign hop_limit earlier so that the assignment
> > references the original un-resized skb instead.
> 
> Unfortunately this is not fixing anything.
> 
> If the IPv6 header was in the skb head before skb_realloc_headroom()
> and/or pskb_expand_head(),
> it would be copied in the new skb head.
> 
> Note how the repro is sending a packet with vlan tag (88A8 : ETH_P_8021AD)
> 
> endto$packet(r0, &(0x7f0000000180)="a6bea8a120e5f8320c30ce5088a8",
> 0x12, 0x0, &(0x7f0000000140)={0x11, 0x0, r3, 0x1, 0x0, 0x6, @local},
> 0x14)
> 
> Current code, using pskb_inet_may_pull() is not ready yet.
> 
> My patch has been tested by syzbot and I was about to submit it.
> 
> diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c
> index 235808cfec705032b545d6f396f8e58f4693e8d8..c4f0383a136cf5f5e6846293078ec8b826c754c9
> 100644
> --- a/net/ipv6/ip6_gre.c
> +++ b/net/ipv6/ip6_gre.c
> @@ -910,7 +910,7 @@ static netdev_tx_t ip6gre_tunnel_xmit(struct sk_buff *skb,
>         __be16 payload_protocol;
>         int ret;
> 
> -       if (!pskb_inet_may_pull(skb))
> +       if (!skb_vlan_inet_prepare(skb, false))
>                 goto tx_err;
> 
>         if (!ip6_tnl_xmit_ctl(t, &t->parms.laddr, &t->parms.raddr))
> @@ -958,7 +958,7 @@ static netdev_tx_t ip6erspan_tunnel_xmit(struct
> sk_buff *skb,
>         __u32 mtu;
>         int nhoff;
> 
> -       if (!pskb_inet_may_pull(skb))
> +       if (!skb_vlan_inet_prepare(skb, false))
>                 goto tx_err;
> 
>         if (!ip6_tnl_xmit_ctl(t, &t->parms.laddr, &t->parms.raddr))

Could you please submit this fix?  There appears to be an open
syzbot report (https://syzkaller.appspot.com/bug?extid=6023ea32e206eef7920a)
that would be addressed by this.

Thanks!

  parent reply	other threads:[~2026-01-05  9:27 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-17  3:07 [PATCH] ip6_tunnel: Fix uninit-value in ip6_tnl_xmit Mazin Al Haddad
2024-12-17  5:42 ` Eric Dumazet
2024-12-17 10:28   ` Mazin Al haddad
2026-01-05  9:26   ` Florian Westphal [this message]
2026-01-05  9:35     ` Eric Dumazet

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=aVuD4kwMyyJlSxIV@strlen.de \
    --to=fw@strlen.de \
    --cc=davem@davemloft.net \
    --cc=dsahern@kernel.org \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mazin@getstate.dev \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=syzbot+6023ea32e206eef7920a@syzkaller.appspotmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.