diff options
author | Eric Dumazet <eric.dumazet@gmail.com> | 2011-01-20 02:16:24 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-01-20 19:59:33 -0500 |
commit | 753ea8e96258d87be1951083b5c4a368524515f1 (patch) | |
tree | 60b07f927e558697a74e387b6ea6af6599d05ad9 /net/ipv6 | |
parent | 2ffa007eaa01cf5fedd6a71f7d43854339a831ee (diff) |
net: ipv6: sit: fix rcu annotations
Fix minor __rcu annotations and remove sparse warnings
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6')
-rw-r--r-- | net/ipv6/sit.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c index 8ce38f10a547..b1599a345c10 100644 --- a/net/ipv6/sit.c +++ b/net/ipv6/sit.c | |||
@@ -412,7 +412,7 @@ static void prl_list_destroy_rcu(struct rcu_head *head) | |||
412 | 412 | ||
413 | p = container_of(head, struct ip_tunnel_prl_entry, rcu_head); | 413 | p = container_of(head, struct ip_tunnel_prl_entry, rcu_head); |
414 | do { | 414 | do { |
415 | n = p->next; | 415 | n = rcu_dereference_protected(p->next, 1); |
416 | kfree(p); | 416 | kfree(p); |
417 | p = n; | 417 | p = n; |
418 | } while (p); | 418 | } while (p); |
@@ -421,15 +421,17 @@ static void prl_list_destroy_rcu(struct rcu_head *head) | |||
421 | static int | 421 | static int |
422 | ipip6_tunnel_del_prl(struct ip_tunnel *t, struct ip_tunnel_prl *a) | 422 | ipip6_tunnel_del_prl(struct ip_tunnel *t, struct ip_tunnel_prl *a) |
423 | { | 423 | { |
424 | struct ip_tunnel_prl_entry *x, **p; | 424 | struct ip_tunnel_prl_entry *x; |
425 | struct ip_tunnel_prl_entry __rcu **p; | ||
425 | int err = 0; | 426 | int err = 0; |
426 | 427 | ||
427 | ASSERT_RTNL(); | 428 | ASSERT_RTNL(); |
428 | 429 | ||
429 | if (a && a->addr != htonl(INADDR_ANY)) { | 430 | if (a && a->addr != htonl(INADDR_ANY)) { |
430 | for (p = &t->prl; *p; p = &(*p)->next) { | 431 | for (p = &t->prl; |
431 | if ((*p)->addr == a->addr) { | 432 | (x = rtnl_dereference(*p)) != NULL; |
432 | x = *p; | 433 | p = &x->next) { |
434 | if (x->addr == a->addr) { | ||
433 | *p = x->next; | 435 | *p = x->next; |
434 | call_rcu(&x->rcu_head, prl_entry_destroy_rcu); | 436 | call_rcu(&x->rcu_head, prl_entry_destroy_rcu); |
435 | t->prl_count--; | 437 | t->prl_count--; |
@@ -438,9 +440,9 @@ ipip6_tunnel_del_prl(struct ip_tunnel *t, struct ip_tunnel_prl *a) | |||
438 | } | 440 | } |
439 | err = -ENXIO; | 441 | err = -ENXIO; |
440 | } else { | 442 | } else { |
441 | if (t->prl) { | 443 | x = rtnl_dereference(t->prl); |
444 | if (x) { | ||
442 | t->prl_count = 0; | 445 | t->prl_count = 0; |
443 | x = t->prl; | ||
444 | call_rcu(&x->rcu_head, prl_list_destroy_rcu); | 446 | call_rcu(&x->rcu_head, prl_list_destroy_rcu); |
445 | t->prl = NULL; | 447 | t->prl = NULL; |
446 | } | 448 | } |
@@ -1179,7 +1181,7 @@ static int __net_init ipip6_fb_tunnel_init(struct net_device *dev) | |||
1179 | if (!dev->tstats) | 1181 | if (!dev->tstats) |
1180 | return -ENOMEM; | 1182 | return -ENOMEM; |
1181 | dev_hold(dev); | 1183 | dev_hold(dev); |
1182 | sitn->tunnels_wc[0] = tunnel; | 1184 | rcu_assign_pointer(sitn->tunnels_wc[0], tunnel); |
1183 | return 0; | 1185 | return 0; |
1184 | } | 1186 | } |
1185 | 1187 | ||
@@ -1196,11 +1198,12 @@ static void __net_exit sit_destroy_tunnels(struct sit_net *sitn, struct list_hea | |||
1196 | for (prio = 1; prio < 4; prio++) { | 1198 | for (prio = 1; prio < 4; prio++) { |
1197 | int h; | 1199 | int h; |
1198 | for (h = 0; h < HASH_SIZE; h++) { | 1200 | for (h = 0; h < HASH_SIZE; h++) { |
1199 | struct ip_tunnel *t = sitn->tunnels[prio][h]; | 1201 | struct ip_tunnel *t; |
1200 | 1202 | ||
1203 | t = rtnl_dereference(sitn->tunnels[prio][h]); | ||
1201 | while (t != NULL) { | 1204 | while (t != NULL) { |
1202 | unregister_netdevice_queue(t->dev, head); | 1205 | unregister_netdevice_queue(t->dev, head); |
1203 | t = t->next; | 1206 | t = rtnl_dereference(t->next); |
1204 | } | 1207 | } |
1205 | } | 1208 | } |
1206 | } | 1209 | } |