* the dev_open/close paths use this to block netpoll activity
* while changing device state
*/
- if (!mutex_trylock(&dev->npinfo->dev_lock))
+ if (!mutex_trylock(&ni->dev_lock))
return;
if (!dev || !netif_running(dev))
poll_napi(dev);
- mutex_unlock(&dev->npinfo->dev_lock);
+ mutex_unlock(&ni->dev_lock);
if (dev->flags & IFF_SLAVE) {
if (ni) {
goto free_npinfo;
}
} else {
- npinfo = ndev->npinfo;
+ npinfo = rtnl_dereference(ndev->npinfo);
atomic_inc(&npinfo->refcnt);
}
struct netpoll_info *npinfo;
unsigned long flags;
- npinfo = np->dev->npinfo;
+ /* rtnl_dereference would be preferable here but
+ * rcu_cleanup_netpoll path can put us in here safely without
+ * holding the rtnl, so plain rcu_dereference it is
+ */
+ npinfo = rtnl_dereference(np->dev->npinfo);
if (!npinfo)
return;