diff options
author | Fabian Frederick <fabf@skynet.be> | 2014-10-06 14:15:20 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-10-06 18:16:30 -0400 |
commit | 79952bca8619b62c9b1a118238ca16ab41be7760 (patch) | |
tree | 069f0e244d4544359e181b91b20117b34695a84d /net/phonet/pn_dev.c | |
parent | e91a159ef58ebcf2155332dc395c6a29dca86051 (diff) |
net: fix rcu access on phonet_routes
-Add __rcu annotation on table to fix sparse warnings:
net/phonet/pn_dev.c:279:25: warning: incorrect type in assignment (different address spaces)
net/phonet/pn_dev.c:279:25: expected struct net_device *<noident>
net/phonet/pn_dev.c:279:25: got void [noderef] <asn:4>*<noident>
net/phonet/pn_dev.c:376:17: warning: incorrect type in assignment (different address spaces)
net/phonet/pn_dev.c:376:17: expected struct net_device *volatile <noident>
net/phonet/pn_dev.c:376:17: got struct net_device [noderef] <asn:4>*<noident>
net/phonet/pn_dev.c:392:17: warning: incorrect type in assignment (different address spaces)
net/phonet/pn_dev.c:392:17: expected struct net_device *<noident>
net/phonet/pn_dev.c:392:17: got void [noderef] <asn:4>*<noident>
-Access table with rcu_access_pointer (fixes the following sparse errors):
net/phonet/pn_dev.c:278:25: error: incompatible types in comparison expression (different address spaces)
net/phonet/pn_dev.c:391:17: error: incompatible types in comparison expression (different address spaces)
Suggested-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Fabian Frederick <fabf@skynet.be>
Acked-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/phonet/pn_dev.c')
-rw-r--r-- | net/phonet/pn_dev.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/net/phonet/pn_dev.c b/net/phonet/pn_dev.c index 56a6146ac94b..a58680016472 100644 --- a/net/phonet/pn_dev.c +++ b/net/phonet/pn_dev.c | |||
@@ -36,7 +36,7 @@ | |||
36 | 36 | ||
37 | struct phonet_routes { | 37 | struct phonet_routes { |
38 | struct mutex lock; | 38 | struct mutex lock; |
39 | struct net_device *table[64]; | 39 | struct net_device __rcu *table[64]; |
40 | }; | 40 | }; |
41 | 41 | ||
42 | struct phonet_net { | 42 | struct phonet_net { |
@@ -275,7 +275,7 @@ static void phonet_route_autodel(struct net_device *dev) | |||
275 | bitmap_zero(deleted, 64); | 275 | bitmap_zero(deleted, 64); |
276 | mutex_lock(&pnn->routes.lock); | 276 | mutex_lock(&pnn->routes.lock); |
277 | for (i = 0; i < 64; i++) | 277 | for (i = 0; i < 64; i++) |
278 | if (dev == pnn->routes.table[i]) { | 278 | if (rcu_access_pointer(pnn->routes.table[i]) == dev) { |
279 | RCU_INIT_POINTER(pnn->routes.table[i], NULL); | 279 | RCU_INIT_POINTER(pnn->routes.table[i], NULL); |
280 | set_bit(i, deleted); | 280 | set_bit(i, deleted); |
281 | } | 281 | } |
@@ -388,7 +388,7 @@ int phonet_route_del(struct net_device *dev, u8 daddr) | |||
388 | 388 | ||
389 | daddr = daddr >> 2; | 389 | daddr = daddr >> 2; |
390 | mutex_lock(&routes->lock); | 390 | mutex_lock(&routes->lock); |
391 | if (dev == routes->table[daddr]) | 391 | if (rcu_access_pointer(routes->table[daddr]) == dev) |
392 | RCU_INIT_POINTER(routes->table[daddr], NULL); | 392 | RCU_INIT_POINTER(routes->table[daddr], NULL); |
393 | else | 393 | else |
394 | dev = NULL; | 394 | dev = NULL; |