From: Stefano Brivio <sbrivio@redhat.com>
To: Eric Dumazet <edumazet@google.com>
Cc: "David S . Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Simon Horman <horms@kernel.org>, Ido Schimmel <idosch@nvidia.com>,
David Ahern <dsahern@kernel.org>,
netdev@vger.kernel.org, eric.dumazet@gmail.com,
Guillaume Nault <gnault@redhat.com>
Subject: Re: [PATCH net] vxlan: do not reuse cached ip_hdr() value after skb_tunnel_check_pmtu()
Date: Tue, 26 May 2026 09:05:02 +0200 (CEST) [thread overview]
Message-ID: <20260526090501.4a6c2c37@elisabeth> (raw)
In-Reply-To: <20260525203642.2389723-1-edumazet@google.com>
On Mon, 25 May 2026 20:36:42 +0000
Eric Dumazet <edumazet@google.com> wrote:
> skb_tunnel_check_pmtu() can change skb->head.
>
> Reusing old_iph afer skb_tunnel_check_pmtu() can cause an UAF.
>
> Use instead ip_hdr(skb) as done in drivers/net/bareudp.c
> and drivers/net/geneve.c.
>
> Found by Sashiko.
>
> Fixes: 4cb47a8644cc ("tunnels: PMTU discovery support for directly bridged IP packets")
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Cc: Stefano Brivio <sbrivio@redhat.com>
Thanks for fixing this one as well.
I wonder if it would be clearer to reassign old_iph from ip_hdr(skb)
after the call to skb_tunnel_check_pmtu(), similarly to what commit
31392048f55f ("vxlan: Pull inner IP header in vxlan_xmit_one().") did.
Or maybe even to drop old_iph altogether, as it caused both bugs (the
one fixed by 31392048f55f and this one).
Either way, you have a fix ready and I guess the priority is to fix
this, and I could also send a follow-up patch for net-next, so:
Reviewed-by: Stefano Brivio <sbrivio@redhat.com>
> ---
> drivers/net/vxlan/vxlan_core.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/vxlan/vxlan_core.c b/drivers/net/vxlan/vxlan_core.c
> index e88798497503b53cbaf5bffad72cf3e1cc956410..b5b1253ac08ba46933249b06f19d1fe5a2ffd114 100644
> --- a/drivers/net/vxlan/vxlan_core.c
> +++ b/drivers/net/vxlan/vxlan_core.c
> @@ -2531,7 +2531,7 @@ void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev,
> goto out_unlock;
> }
>
> - tos = ip_tunnel_ecn_encap(tos, old_iph, skb);
> + tos = ip_tunnel_ecn_encap(tos, ip_hdr(skb), skb);
> ttl = ttl ? : ip4_dst_hoplimit(&rt->dst);
> err = vxlan_build_skb(skb, ndst, sizeof(struct iphdr),
> vni, md, flags, udp_sum);
> @@ -2605,7 +2605,7 @@ void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev,
> goto out_unlock;
> }
>
> - tos = ip_tunnel_ecn_encap(tos, old_iph, skb);
> + tos = ip_tunnel_ecn_encap(tos, ip_hdr(skb), skb);
> ttl = ttl ? : ip6_dst_hoplimit(ndst);
> skb_scrub_packet(skb, xnet);
> err = vxlan_build_skb(skb, ndst, sizeof(struct ipv6hdr),
--
Stefano
prev parent reply other threads:[~2026-05-26 7:05 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-25 20:36 [PATCH net] vxlan: do not reuse cached ip_hdr() value after skb_tunnel_check_pmtu() Eric Dumazet
2026-05-26 7:05 ` Stefano Brivio [this message]
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=20260526090501.4a6c2c37@elisabeth \
--to=sbrivio@redhat.com \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@google.com \
--cc=eric.dumazet@gmail.com \
--cc=gnault@redhat.com \
--cc=horms@kernel.org \
--cc=idosch@nvidia.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.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