Netdev List
 help / color / mirror / Atom feed
From: Vadim Fedorenko <vadim.fedorenko@linux.dev>
To: Eric Dumazet <edumazet@google.com>,
	"David S . Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>
Cc: Simon Horman <horms@kernel.org>, Ido Schimmel <idosch@nvidia.com>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	netdev@vger.kernel.org, eric.dumazet@gmail.com,
	stable@vger.kernel.org
Subject: Re: [PATCH net 3/5] vxlan: use neigh_ha_snapshot() in route_shortcircuit()
Date: Thu, 23 Jul 2026 17:41:04 +0100	[thread overview]
Message-ID: <0550c263-136b-4f50-8424-409ebd805503@linux.dev> (raw)
In-Reply-To: <20260723144249.759100-4-edumazet@google.com>

On 23/07/2026 15:42, Eric Dumazet wrote:
> The neighbour hardware address n->ha can be updated asynchronously by the
> neighbour subsystem, protected by n->ha_lock seqlock. Reading n->ha without
> holding the seqlock loop can lead to torn reads or reading a partially updated
> MAC address.
> 
> Use neigh_ha_snapshot() in route_shortcircuit() to safely copy n->ha under
> read_seqbegin()/read_seqretry() lock protection before using it.
> 
> Note that arp_reduce() and neigh_reduce() seem to have the same issue
> left for future patches.
> 
> Fixes: e4f67addf158 ("add DOVE extensions for VXLAN")
> Cc: stable@vger.kernel.org
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> ---
>   drivers/net/vxlan/vxlan_core.c | 6 ++++--
>   1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/vxlan/vxlan_core.c b/drivers/net/vxlan/vxlan_core.c
> index fb4a706cd5786d1937b1922acced31ffdb187c2f..10dd19eec09e266197ee51330a652f4e76c9643a 100644
> --- a/drivers/net/vxlan/vxlan_core.c
> +++ b/drivers/net/vxlan/vxlan_core.c
> @@ -2159,9 +2159,11 @@ static bool route_shortcircuit(struct net_device *dev, struct sk_buff *skb)
>   	}
>   
>   	if (n) {
> +		u8 haddr[ETH_ALEN];
>   		bool diff;
>   
> -		diff = !ether_addr_equal(eth_hdr(skb)->h_dest, n->ha);
> +		neigh_ha_snapshot(haddr, n, dev);
> +		diff = !ether_addr_equal_unaligned(eth_hdr(skb)->h_dest, haddr);
>   		if (diff) {
>   			if (skb_cow_head(skb, 0)) {
>   				neigh_release(n);
> @@ -2169,7 +2171,7 @@ static bool route_shortcircuit(struct net_device *dev, struct sk_buff *skb)
>   			}
>   			memcpy(eth_hdr(skb)->h_source, eth_hdr(skb)->h_dest,
>   				dev->addr_len);
> -			memcpy(eth_hdr(skb)->h_dest, n->ha, dev->addr_len);
> +			memcpy(eth_hdr(skb)->h_dest, haddr, dev->addr_len);
>   		}
>   		neigh_release(n);
>   		return diff;

Reviewed-by: Vadim Fedorenko <vadim.fedorenko@linux.dev>

  reply	other threads:[~2026-07-23 16:41 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-23 14:42 [PATCH net 0/5] vxlan: fixes for skb header pulling, cloning, and concurrency in TX path Eric Dumazet
2026-07-23 14:42 ` [PATCH net 1/5] vxlan: re-fetch eth header after route_shortcircuit() Eric Dumazet
2026-07-23 16:37   ` Vadim Fedorenko
2026-07-23 14:42 ` [PATCH net 2/5] vxlan: unclone skb head before modifying eth header in route_shortcircuit() Eric Dumazet
2026-07-23 14:42 ` [PATCH net 3/5] vxlan: use neigh_ha_snapshot() " Eric Dumazet
2026-07-23 16:41   ` Vadim Fedorenko [this message]
2026-07-23 14:42 ` [PATCH net 4/5] vxlan: use pskb_network_may_pull() " Eric Dumazet
2026-07-23 16:42   ` Vadim Fedorenko
2026-07-23 14:42 ` [PATCH net 5/5] vxlan: use pskb_network_may_pull() for transmit path header pulls Eric Dumazet
2026-07-23 16:43   ` Vadim Fedorenko

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=0550c263-136b-4f50-8424-409ebd805503@linux.dev \
    --to=vadim.fedorenko@linux.dev \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=eric.dumazet@gmail.com \
    --cc=horms@kernel.org \
    --cc=idosch@nvidia.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=stable@vger.kernel.org \
    /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