Commit 0790bbb6 authored by Neil Horman's avatar Neil Horman Committed by David S. Miller

netpoll: cleanup sparse warnings

With my recent commit I introduced two sparse warnings.  Looking closer there
were a few more in the same file, so I fixed them all up.  Basic rcu pointer
dereferencing suff.

I've validated these changes using CONFIG_PROVE_RCU while starting and stopping
netconsole repeatedly in bonded and non-bonded configurations
Signed-off-by: default avatarNeil Horman <nhorman@tuxdriver.com>
CC: fengguang.wu@intel.com
CC: David Miller <davem@davemloft.net>
CC: eric.dumazet@gmail.com
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 2cde6acd
...@@ -206,7 +206,7 @@ static void netpoll_poll_dev(struct net_device *dev) ...@@ -206,7 +206,7 @@ static void netpoll_poll_dev(struct net_device *dev)
* the dev_open/close paths use this to block netpoll activity * the dev_open/close paths use this to block netpoll activity
* while changing device state * while changing device state
*/ */
if (!mutex_trylock(&dev->npinfo->dev_lock)) if (!mutex_trylock(&ni->dev_lock))
return; return;
if (!dev || !netif_running(dev)) if (!dev || !netif_running(dev))
...@@ -221,7 +221,7 @@ static void netpoll_poll_dev(struct net_device *dev) ...@@ -221,7 +221,7 @@ static void netpoll_poll_dev(struct net_device *dev)
poll_napi(dev); poll_napi(dev);
mutex_unlock(&dev->npinfo->dev_lock); mutex_unlock(&ni->dev_lock);
if (dev->flags & IFF_SLAVE) { if (dev->flags & IFF_SLAVE) {
if (ni) { if (ni) {
...@@ -1056,7 +1056,7 @@ int __netpoll_setup(struct netpoll *np, struct net_device *ndev, gfp_t gfp) ...@@ -1056,7 +1056,7 @@ int __netpoll_setup(struct netpoll *np, struct net_device *ndev, gfp_t gfp)
goto free_npinfo; goto free_npinfo;
} }
} else { } else {
npinfo = ndev->npinfo; npinfo = rtnl_dereference(ndev->npinfo);
atomic_inc(&npinfo->refcnt); atomic_inc(&npinfo->refcnt);
} }
...@@ -1236,7 +1236,11 @@ void __netpoll_cleanup(struct netpoll *np) ...@@ -1236,7 +1236,11 @@ void __netpoll_cleanup(struct netpoll *np)
struct netpoll_info *npinfo; struct netpoll_info *npinfo;
unsigned long flags; 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) if (!npinfo)
return; return;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment