Re: [PATCH net-next 05/12] ipvlan: Make the addrs_lock be per port

From: Paolo Abeni
Date: Tue Nov 25 2025 - 09:16:52 EST


On 11/20/25 6:49 PM, Dmitry Skorodumov wrote:
> Make the addrs_lock be per port, not per ipvlan dev.
>
> This appears to be a very minor problem though.
> Since it's highly unlikely that ipvlan_add_addr() will
> be called on 2 CPU simultaneously. But nevertheless,
> this may cause:
>
> 1. False-negative of ipvlan_addr_busy(): one interface
> iterated through all port->ipvlans + ipvlan->addrs
> under some ipvlan spinlock, and another added IP
> under its own lock. Though this is only possible
> for IPv6, since looks like only ipvlan_addr6_event() can be
> called without rtnl_lock.
>
> 2. Race since ipvlan_ht_addr_add(port) is called under
> different ipvlan->addrs_lock locks
>
> This should not affect performance, since add/remove IP
> is a rare situation and spinlock is not locked on fast
> paths.
>
> Also, it's quite convenient to have addrs_lock on
> ipvl_port, to dynamically prevent conflict of IPs
> with addresses on main port.
>
> CC: Paolo Abeni <pabeni@xxxxxxxxxx>
> Signed-off-by: Dmitry Skorodumov <skorodumov.dmitry@xxxxxxxxxx>

This really looks like a fix, that should go via the 'net' tree with a
suitable fixes tag.

/P