Re: [PATCH net 2/2] ipvlan: Take addr_lock in ipvlan_open()

From: Paolo Abeni

Date: Thu Dec 04 2025 - 09:43:03 EST


On 12/2/25 3:11 PM, Dmitry Skorodumov wrote:
> diff --git a/drivers/net/ipvlan/ipvlan_main.c b/drivers/net/ipvlan/ipvlan_main.c
> index c390f4241621..53d311af2f44 100644
> --- a/drivers/net/ipvlan/ipvlan_main.c
> +++ b/drivers/net/ipvlan/ipvlan_main.c
> @@ -182,18 +182,18 @@ static void ipvlan_uninit(struct net_device *dev)
> static int ipvlan_open(struct net_device *dev)
> {
> struct ipvl_dev *ipvlan = netdev_priv(dev);
> + struct ipvl_port *port = ipvlan->port;
> struct ipvl_addr *addr;
>
> - if (ipvlan->port->mode == IPVLAN_MODE_L3 ||
> - ipvlan->port->mode == IPVLAN_MODE_L3S)
> + if (port->mode == IPVLAN_MODE_L3 || port->mode == IPVLAN_MODE_L3S)
> dev->flags |= IFF_NOARP;
> else
> dev->flags &= ~IFF_NOARP;
>
> - rcu_read_lock();
> + spin_lock_bh(&port->addrs_lock);
> list_for_each_entry_rcu(addr, &ipvlan->addrs, anode)

I'm surprised lockdep/rcu debug does not complain above. In any case I
think you should replace list_for_each_entry_rcu() with
list_for_each_entry(), here and below.

Thanks,

Paolo