Subject: Re: [PATCH net-next 02/11] net: add helpers for lookup and walking netdevs under netdev_lock()

From: Jakub Kicinski <[email-masked]>
Date: Tue, 14 Jan 2025 06:45:38 -0800

On Tue, 14 Jan 2025 14:03:35 +0100 Eric Dumazet wrote:
> > +struct net_device *__netdev_put_lock(struct net_device *dev)
> > +{
> > +       netdev_lock(dev);
> > +       if (dev->reg_state > NETREG_REGISTERED) {  
> 
> I presume the netdev lock will be held at some point in
> netdev_run_todo and/or unregister_netdevice_many_notify
> so no need for a READ_ONCE() here.

Yes, the only unprotected write is in free_netdev(), but we're holding
a reference here so if we get to free there's a bug somewhere else.
I'll reorder patches 2 and 3.