netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stefano Brivio <sbrivio@redhat.com>
To: Antoine Tenart <atenart@kernel.org>
Cc: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com,
	edumazet@google.com, dsahern@kernel.org, netdev@vger.kernel.org,
	Adrian Moreno <amorenoz@redhat.com>
Subject: Re: [PATCH net] tunnels: reset the GSO metadata before reusing the skb
Date: Fri, 5 Sep 2025 16:02:15 +0200	[thread overview]
Message-ID: <20250905160215.6ca5d764@elisabeth> (raw)
In-Reply-To: <20250904125351.159740-1-atenart@kernel.org>

On Thu,  4 Sep 2025 14:53:50 +0200
Antoine Tenart <atenart@kernel.org> wrote:

> If a GSO skb is sent through a Geneve tunnel and if Geneve options are
> added, the split GSO skb might not fit in the MTU anymore and an ICMP
> frag needed packet can be generated. In such case the ICMP packet might
> go through the segmentation logic (and dropped) later if it reaches a
> path were the GSO status is checked and segmentation is required.
> 
> This is especially true when an OvS bridge is used with a Geneve tunnel
> attached to it. The following set of actions could lead to the ICMP
> packet being wrongfully segmented:
> 
> 1. An skb is constructed by the TCP layer (e.g. gso_type SKB_GSO_TCPV4,
>    segs >= 2).
> 
> 2. The skb hits the OvS bridge where Geneve options are added by an OvS
>    action before being sent through the tunnel.
> 
> 3. When the skb is xmited in the tunnel, the split skb does not fit
>    anymore in the MTU and iptunnel_pmtud_build_icmp is called to
>    generate an ICMP fragmentation needed packet. This is done by reusing
>    the original (GSO!) skb. The GSO metadata is not cleared.
> 
> 4. The ICMP packet being sent back hits the OvS bridge again and because
>    skb_is_gso returns true, it goes through queue_gso_packets...
> 
> 5. ...where __skb_gso_segment is called. The skb is then dropped.
> 
> 6. Note that in the above example on re-transmission the skb won't be a
>    GSO one as it would be segmented (len > MSS) and the ICMP packet
>    should go through.
> 
> Fix this by resetting the GSO information before reusing an skb in
> iptunnel_pmtud_build_icmp and iptunnel_pmtud_build_icmpv6.
> 
> Fixes: 4cb47a8644cc ("tunnels: PMTU discovery support for directly bridged IP packets")
> Reported-by: Adrian Moreno <amorenoz@redhat.com>
> Signed-off-by: Antoine Tenart <atenart@kernel.org>

Thanks for fixing this!

Reviewed-by: Stefano Brivio <sbrivio@redhat.com>

-- 
Stefano


  reply	other threads:[~2025-09-05 14:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-04 12:53 [PATCH net] tunnels: reset the GSO metadata before reusing the skb Antoine Tenart
2025-09-05 14:02 ` Stefano Brivio [this message]
2025-09-09 11:10 ` patchwork-bot+netdevbpf

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=20250905160215.6ca5d764@elisabeth \
    --to=sbrivio@redhat.com \
    --cc=amorenoz@redhat.com \
    --cc=atenart@kernel.org \
    --cc=davem@davemloft.net \
    --cc=dsahern@kernel.org \
    --cc=edumazet@google.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;
as well as URLs for NNTP newsgroup(s).