aboutsummaryrefslogtreecommitdiffstats
path: root/net/core/netpoll.c
diff options
context:
space:
mode:
authorNeil Horman <nhorman@tuxdriver.com>2013-02-11 05:25:31 -0500
committerDavid S. Miller <davem@davemloft.net>2013-02-11 19:19:58 -0500
commit0790bbb68f9d483348c1d65381f3dd92602bfd05 (patch)
tree638ca1562638653c2c77e2c192359c4f2f289b32 /net/core/netpoll.c
parent2cde6acd49daca58b96f1fbc697492825511ad31 (diff)
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: Neil Horman <nhorman@tuxdriver.com> CC: fengguang.wu@intel.com CC: David Miller <davem@davemloft.net> CC: eric.dumazet@gmail.com Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core/netpoll.c')
-rw-r--r--net/core/netpoll.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/net/core/netpoll.c b/net/core/netpoll.c
index c536474e2260..bcfd4f4599a5 100644
--- a/net/core/netpoll.c
+++ b/net/core/netpoll.c
@@ -206,7 +206,7 @@ static void netpoll_poll_dev(struct net_device *dev)
206 * the dev_open/close paths use this to block netpoll activity 206 * the dev_open/close paths use this to block netpoll activity
207 * while changing device state 207 * while changing device state
208 */ 208 */
209 if (!mutex_trylock(&dev->npinfo->dev_lock)) 209 if (!mutex_trylock(&ni->dev_lock))
210 return; 210 return;
211 211
212 if (!dev || !netif_running(dev)) 212 if (!dev || !netif_running(dev))
@@ -221,7 +221,7 @@ static void netpoll_poll_dev(struct net_device *dev)
221 221
222 poll_napi(dev); 222 poll_napi(dev);
223 223
224 mutex_unlock(&dev->npinfo->dev_lock); 224 mutex_unlock(&ni->dev_lock);
225 225
226 if (dev->flags & IFF_SLAVE) { 226 if (dev->flags & IFF_SLAVE) {
227 if (ni) { 227 if (ni) {
@@ -1056,7 +1056,7 @@ int __netpoll_setup(struct netpoll *np, struct net_device *ndev, gfp_t gfp)
1056 goto free_npinfo; 1056 goto free_npinfo;
1057 } 1057 }
1058 } else { 1058 } else {
1059 npinfo = ndev->npinfo; 1059 npinfo = rtnl_dereference(ndev->npinfo);
1060 atomic_inc(&npinfo->refcnt); 1060 atomic_inc(&npinfo->refcnt);
1061 } 1061 }
1062 1062
@@ -1236,7 +1236,11 @@ void __netpoll_cleanup(struct netpoll *np)
1236 struct netpoll_info *npinfo; 1236 struct netpoll_info *npinfo;
1237 unsigned long flags; 1237 unsigned long flags;
1238 1238
1239 npinfo = np->dev->npinfo; 1239 /* rtnl_dereference would be preferable here but
1240 * rcu_cleanup_netpoll path can put us in here safely without
1241 * holding the rtnl, so plain rcu_dereference it is
1242 */
1243 npinfo = rtnl_dereference(np->dev->npinfo);
1240 if (!npinfo) 1244 if (!npinfo)
1241 return; 1245 return;
1242 1246