Subject: Re: [PATCH net-next] net: core: decouple ifalias get/set from rtnl lock

From: Florian Westphal <[email-masked]>
Date: Mon, 2 Oct 2017 11:22:57 +0200

David Miller <[email-masked]> wrote:
> From: Florian Westphal <[email-masked]>
> Date: Fri, 29 Sep 2017 13:21:50 +0200
> 
> > @@ -1488,7 +1484,7 @@ static void netdev_release(struct device *d)
> >  
> >  	BUG_ON(dev->reg_state != NETREG_RELEASED);
> >  
> > -	kfree(dev->ifalias);
> > +	kfree(rcu_access_pointer(dev->ifalias));
> >  	netdev_freemem(dev);
> >  }
> >  
> 
> "kfree_rcu()" at least?
> 
> If the deal is that you don't need to do and RCU free because
> netdevice objects disappear synchronously, and you can therefore prove
> that no RCU based async access can occur to dev->ifalias, then you
> need to add a comment here.

Ok, I will add a comment.

netdev_release gets called via kobject_put() if this was last reference
to the device. At that point the device has already been removed from
all lists (and private destructor was invoked too).

Also, netdev_freemem frees the net_device memory immediately
so no other cpu is allowed to use dev at this point.