Netdev List
 help / color / mirror / Atom feed
From: Ido Schimmel <idosch@nvidia.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>, David Ahern <dsahern@kernel.org>,
	netdev@vger.kernel.org, eric.dumazet@gmail.com
Subject: Re: [PATCH net-next] gre: fix ERSPAN o_flags race/corruption in xmit and fill_info
Date: Wed, 17 Jun 2026 09:34:21 +0300	[thread overview]
Message-ID: <20260617063421.GA948096@shredder> (raw)
In-Reply-To: <20260615140333.3161072-1-edumazet@google.com>

On Mon, Jun 15, 2026 at 02:03:33PM +0000, Eric Dumazet wrote:
> @@ -692,7 +689,7 @@ static netdev_tx_t ipgre_xmit(struct sk_buff *skb,
>  					      tunnel->parms.o_flags)))
>  		goto free_skb;
>  
> -	__gre_xmit(skb, dev, tnl_params, skb->protocol);
> +	__gre_xmit(skb, dev, tnl_params, skb->protocol, tunnel->parms.o_flags);
>  	return NETDEV_TX_OK;
>  
>  free_skb:
> @@ -705,6 +702,7 @@ static netdev_tx_t erspan_xmit(struct sk_buff *skb,
>  			       struct net_device *dev)
>  {
>  	struct ip_tunnel *tunnel = netdev_priv(dev);
> +	IP_TUNNEL_DECLARE_FLAGS(flags);
>  	bool truncate = false;
>  	__be16 proto;
>  
> @@ -728,10 +726,12 @@ static netdev_tx_t erspan_xmit(struct sk_buff *skb,
>  		truncate = true;
>  	}
>  
> +	ip_tunnel_flags_copy(flags, tunnel->parms.o_flags);
> +
>  	/* Push ERSPAN header */
>  	if (tunnel->erspan_ver == 0) {
>  		proto = htons(ETH_P_ERSPAN);
> -		__clear_bit(IP_TUNNEL_SEQ_BIT, tunnel->parms.o_flags);
> +		__clear_bit(IP_TUNNEL_SEQ_BIT, flags);
>  	} else if (tunnel->erspan_ver == 1) {
>  		erspan_build_header(skb, ntohl(tunnel->parms.o_key),
>  				    tunnel->index,
> @@ -746,8 +746,8 @@ static netdev_tx_t erspan_xmit(struct sk_buff *skb,
>  		goto free_skb;
>  	}
>  
> -	__clear_bit(IP_TUNNEL_KEY_BIT, tunnel->parms.o_flags);
> -	__gre_xmit(skb, dev, &tunnel->parms.iph, proto);
> +	__clear_bit(IP_TUNNEL_KEY_BIT, flags);
> +	__gre_xmit(skb, dev, &tunnel->parms.iph, proto, flags);
>  	return NETDEV_TX_OK;
>  
>  free_skb:
> @@ -776,7 +776,7 @@ static netdev_tx_t gre_tap_xmit(struct sk_buff *skb,
>  	if (skb_cow_head(skb, dev->needed_headroom))
>  		goto free_skb;
>  
> -	__gre_xmit(skb, dev, &tunnel->parms.iph, htons(ETH_P_TEB));
> +	__gre_xmit(skb, dev, &tunnel->parms.iph, htons(ETH_P_TEB), tunnel->parms.o_flags);

Eric, did you see the feedback from Sashiko [1]?

WDYT about aligning ipgre and gretap with erspan and passing a copy of
the output flags to __gre_xmit() instead of passing
'tunnel->parms.o_flags' directly?

The mismatch between the output flags and the tunnel header length is a
different issue (pre-existing).

[1] https://sashiko.dev/#/patchset/20260615140333.3161072-1-edumazet%40google.com

>  	return NETDEV_TX_OK;
>  
>  free_skb:

      reply	other threads:[~2026-06-17  6:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-15 14:03 [PATCH net-next] gre: fix ERSPAN o_flags race/corruption in xmit and fill_info Eric Dumazet
2026-06-17  6:34 ` Ido Schimmel [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=20260617063421.GA948096@shredder \
    --to=idosch@nvidia.com \
    --cc=davem@davemloft.net \
    --cc=dsahern@kernel.org \
    --cc=edumazet@google.com \
    --cc=eric.dumazet@gmail.com \
    --cc=horms@kernel.org \
    --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