aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorEric Dumazet <eric.dumazet@gmail.com>2011-08-11 15:30:52 -0400
committerDavid S. Miller <davem@davemloft.net>2011-08-12 05:55:28 -0400
commit33d480ce6d43326e2541fd79b3548858a174ec3c (patch)
treec938ee8c07a2e0f33178069b55439a54188f38fa /net
parentcd28ca0a3dd17c68d24b839602a0e6268ad28b5d (diff)
net: cleanup some rcu_dereference_raw
RCU api had been completed and rcu_access_pointer() or rcu_dereference_protected() are better than generic rcu_dereference_raw() Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/core/dev.c10
-rw-r--r--net/core/fib_rules.c2
-rw-r--r--net/core/net-sysfs.c4
-rw-r--r--net/ipv4/ipmr.c4
-rw-r--r--net/ipv4/route.c6
-rw-r--r--net/ipv4/udp.c7
-rw-r--r--net/ipv6/raw.c4
-rw-r--r--net/ipv6/udp.c2
-rw-r--r--net/mac80211/mesh_pathtbl.c4
-rw-r--r--net/netlink/af_netlink.c2
10 files changed, 22 insertions, 23 deletions
diff --git a/net/core/dev.c b/net/core/dev.c
index 9428766d0140..d22ffd722ee3 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2673,13 +2673,13 @@ static int get_rps_cpu(struct net_device *dev, struct sk_buff *skb,
2673 map = rcu_dereference(rxqueue->rps_map); 2673 map = rcu_dereference(rxqueue->rps_map);
2674 if (map) { 2674 if (map) {
2675 if (map->len == 1 && 2675 if (map->len == 1 &&
2676 !rcu_dereference_raw(rxqueue->rps_flow_table)) { 2676 !rcu_access_pointer(rxqueue->rps_flow_table)) {
2677 tcpu = map->cpus[0]; 2677 tcpu = map->cpus[0];
2678 if (cpu_online(tcpu)) 2678 if (cpu_online(tcpu))
2679 cpu = tcpu; 2679 cpu = tcpu;
2680 goto done; 2680 goto done;
2681 } 2681 }
2682 } else if (!rcu_dereference_raw(rxqueue->rps_flow_table)) { 2682 } else if (!rcu_access_pointer(rxqueue->rps_flow_table)) {
2683 goto done; 2683 goto done;
2684 } 2684 }
2685 2685
@@ -5727,8 +5727,8 @@ void netdev_run_todo(void)
5727 5727
5728 /* paranoia */ 5728 /* paranoia */
5729 BUG_ON(netdev_refcnt_read(dev)); 5729 BUG_ON(netdev_refcnt_read(dev));
5730 WARN_ON(rcu_dereference_raw(dev->ip_ptr)); 5730 WARN_ON(rcu_access_pointer(dev->ip_ptr));
5731 WARN_ON(rcu_dereference_raw(dev->ip6_ptr)); 5731 WARN_ON(rcu_access_pointer(dev->ip6_ptr));
5732 WARN_ON(dev->dn_ptr); 5732 WARN_ON(dev->dn_ptr);
5733 5733
5734 if (dev->destructor) 5734 if (dev->destructor)
@@ -5932,7 +5932,7 @@ void free_netdev(struct net_device *dev)
5932 kfree(dev->_rx); 5932 kfree(dev->_rx);
5933#endif 5933#endif
5934 5934
5935 kfree(rcu_dereference_raw(dev->ingress_queue)); 5935 kfree(rcu_dereference_protected(dev->ingress_queue, 1));
5936 5936
5937 /* Flush device addresses */ 5937 /* Flush device addresses */
5938 dev_addr_flush(dev); 5938 dev_addr_flush(dev);
diff --git a/net/core/fib_rules.c b/net/core/fib_rules.c
index 0657b57df558..67c5c288cd80 100644
--- a/net/core/fib_rules.c
+++ b/net/core/fib_rules.c
@@ -545,7 +545,7 @@ static int fib_nl_fill_rule(struct sk_buff *skb, struct fib_rule *rule,
545 frh->flags = rule->flags; 545 frh->flags = rule->flags;
546 546
547 if (rule->action == FR_ACT_GOTO && 547 if (rule->action == FR_ACT_GOTO &&
548 rcu_dereference_raw(rule->ctarget) == NULL) 548 rcu_access_pointer(rule->ctarget) == NULL)
549 frh->flags |= FIB_RULE_UNRESOLVED; 549 frh->flags |= FIB_RULE_UNRESOLVED;
550 550
551 if (rule->iifname[0]) { 551 if (rule->iifname[0]) {
diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c
index b1ab887520a8..56e42ab7cbc6 100644
--- a/net/core/net-sysfs.c
+++ b/net/core/net-sysfs.c
@@ -712,13 +712,13 @@ static void rx_queue_release(struct kobject *kobj)
712 struct rps_dev_flow_table *flow_table; 712 struct rps_dev_flow_table *flow_table;
713 713
714 714
715 map = rcu_dereference_raw(queue->rps_map); 715 map = rcu_dereference_protected(queue->rps_map, 1);
716 if (map) { 716 if (map) {
717 RCU_INIT_POINTER(queue->rps_map, NULL); 717 RCU_INIT_POINTER(queue->rps_map, NULL);
718 kfree_rcu(map, rcu); 718 kfree_rcu(map, rcu);
719 } 719 }
720 720
721 flow_table = rcu_dereference_raw(queue->rps_flow_table); 721 flow_table = rcu_dereference_protected(queue->rps_flow_table, 1);
722 if (flow_table) { 722 if (flow_table) {
723 RCU_INIT_POINTER(queue->rps_flow_table, NULL); 723 RCU_INIT_POINTER(queue->rps_flow_table, NULL);
724 call_rcu(&flow_table->rcu, rps_dev_flow_table_release); 724 call_rcu(&flow_table->rcu, rps_dev_flow_table_release);
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c
index f550285c977b..6164e982e0ef 100644
--- a/net/ipv4/ipmr.c
+++ b/net/ipv4/ipmr.c
@@ -1203,7 +1203,7 @@ int ip_mroute_setsockopt(struct sock *sk, int optname, char __user *optval, unsi
1203 return -ENOENT; 1203 return -ENOENT;
1204 1204
1205 if (optname != MRT_INIT) { 1205 if (optname != MRT_INIT) {
1206 if (sk != rcu_dereference_raw(mrt->mroute_sk) && 1206 if (sk != rcu_access_pointer(mrt->mroute_sk) &&
1207 !capable(CAP_NET_ADMIN)) 1207 !capable(CAP_NET_ADMIN))
1208 return -EACCES; 1208 return -EACCES;
1209 } 1209 }
@@ -1230,7 +1230,7 @@ int ip_mroute_setsockopt(struct sock *sk, int optname, char __user *optval, unsi
1230 rtnl_unlock(); 1230 rtnl_unlock();
1231 return ret; 1231 return ret;
1232 case MRT_DONE: 1232 case MRT_DONE:
1233 if (sk != rcu_dereference_raw(mrt->mroute_sk)) 1233 if (sk != rcu_access_pointer(mrt->mroute_sk))
1234 return -EACCES; 1234 return -EACCES;
1235 return ip_ra_control(sk, 0, NULL); 1235 return ip_ra_control(sk, 0, NULL);
1236 case MRT_ADD_VIF: 1236 case MRT_ADD_VIF:
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index cb7efe0567f0..d6e32138f712 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -324,7 +324,7 @@ static struct rtable *rt_cache_get_first(struct seq_file *seq)
324 struct rtable *r = NULL; 324 struct rtable *r = NULL;
325 325
326 for (st->bucket = rt_hash_mask; st->bucket >= 0; --st->bucket) { 326 for (st->bucket = rt_hash_mask; st->bucket >= 0; --st->bucket) {
327 if (!rcu_dereference_raw(rt_hash_table[st->bucket].chain)) 327 if (!rcu_access_pointer(rt_hash_table[st->bucket].chain))
328 continue; 328 continue;
329 rcu_read_lock_bh(); 329 rcu_read_lock_bh();
330 r = rcu_dereference_bh(rt_hash_table[st->bucket].chain); 330 r = rcu_dereference_bh(rt_hash_table[st->bucket].chain);
@@ -350,7 +350,7 @@ static struct rtable *__rt_cache_get_next(struct seq_file *seq,
350 do { 350 do {
351 if (--st->bucket < 0) 351 if (--st->bucket < 0)
352 return NULL; 352 return NULL;
353 } while (!rcu_dereference_raw(rt_hash_table[st->bucket].chain)); 353 } while (!rcu_access_pointer(rt_hash_table[st->bucket].chain));
354 rcu_read_lock_bh(); 354 rcu_read_lock_bh();
355 r = rcu_dereference_bh(rt_hash_table[st->bucket].chain); 355 r = rcu_dereference_bh(rt_hash_table[st->bucket].chain);
356 } 356 }
@@ -762,7 +762,7 @@ static void rt_do_flush(struct net *net, int process_context)
762 762
763 if (process_context && need_resched()) 763 if (process_context && need_resched())
764 cond_resched(); 764 cond_resched();
765 rth = rcu_dereference_raw(rt_hash_table[i].chain); 765 rth = rcu_access_pointer(rt_hash_table[i].chain);
766 if (!rth) 766 if (!rth)
767 continue; 767 continue;
768 768
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index 1b5a19340a95..c1d5facab7c9 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -1461,10 +1461,9 @@ int udp_queue_rcv_skb(struct sock *sk, struct sk_buff *skb)
1461 } 1461 }
1462 } 1462 }
1463 1463
1464 if (rcu_dereference_raw(sk->sk_filter)) { 1464 if (rcu_access_pointer(sk->sk_filter) &&
1465 if (udp_lib_checksum_complete(skb)) 1465 udp_lib_checksum_complete(skb))
1466 goto drop; 1466 goto drop;
1467 }
1468 1467
1469 1468
1470 if (sk_rcvqueues_full(sk, skb)) 1469 if (sk_rcvqueues_full(sk, skb))
diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c
index 4f45dc9e4f5e..f34902f1ba33 100644
--- a/net/ipv6/raw.c
+++ b/net/ipv6/raw.c
@@ -372,9 +372,9 @@ void raw6_icmp_error(struct sk_buff *skb, int nexthdr,
372 read_unlock(&raw_v6_hashinfo.lock); 372 read_unlock(&raw_v6_hashinfo.lock);
373} 373}
374 374
375static inline int rawv6_rcv_skb(struct sock * sk, struct sk_buff * skb) 375static inline int rawv6_rcv_skb(struct sock *sk, struct sk_buff *skb)
376{ 376{
377 if ((raw6_sk(sk)->checksum || rcu_dereference_raw(sk->sk_filter)) && 377 if ((raw6_sk(sk)->checksum || rcu_access_pointer(sk->sk_filter)) &&
378 skb_checksum_complete(skb)) { 378 skb_checksum_complete(skb)) {
379 atomic_inc(&sk->sk_drops); 379 atomic_inc(&sk->sk_drops);
380 kfree_skb(skb); 380 kfree_skb(skb);
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
index 29213b51c499..97e47f06e8b7 100644
--- a/net/ipv6/udp.c
+++ b/net/ipv6/udp.c
@@ -533,7 +533,7 @@ int udpv6_queue_rcv_skb(struct sock * sk, struct sk_buff *skb)
533 } 533 }
534 } 534 }
535 535
536 if (rcu_dereference_raw(sk->sk_filter)) { 536 if (rcu_access_pointer(sk->sk_filter)) {
537 if (udp_lib_checksum_complete(skb)) 537 if (udp_lib_checksum_complete(skb))
538 goto drop; 538 goto drop;
539 } 539 }
diff --git a/net/mac80211/mesh_pathtbl.c b/net/mac80211/mesh_pathtbl.c
index 068ee6518254..dc7ae8d31aaf 100644
--- a/net/mac80211/mesh_pathtbl.c
+++ b/net/mac80211/mesh_pathtbl.c
@@ -843,6 +843,6 @@ void mesh_path_expire(struct ieee80211_sub_if_data *sdata)
843void mesh_pathtbl_unregister(void) 843void mesh_pathtbl_unregister(void)
844{ 844{
845 /* no need for locking during exit path */ 845 /* no need for locking during exit path */
846 mesh_table_free(rcu_dereference_raw(mesh_paths), true); 846 mesh_table_free(rcu_dereference_protected(mesh_paths, 1), true);
847 mesh_table_free(rcu_dereference_raw(mpp_paths), true); 847 mesh_table_free(rcu_dereference_protected(mpp_paths, 1), true);
848} 848}
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index 0a4db0211da0..4330db99fabf 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -1578,7 +1578,7 @@ int __netlink_change_ngroups(struct sock *sk, unsigned int groups)
1578 new = kzalloc(sizeof(*new) + NLGRPSZ(groups), GFP_ATOMIC); 1578 new = kzalloc(sizeof(*new) + NLGRPSZ(groups), GFP_ATOMIC);
1579 if (!new) 1579 if (!new)
1580 return -ENOMEM; 1580 return -ENOMEM;
1581 old = rcu_dereference_raw(tbl->listeners); 1581 old = rcu_dereference_protected(tbl->listeners, 1);
1582 memcpy(new->masks, old->masks, NLGRPSZ(tbl->groups)); 1582 memcpy(new->masks, old->masks, NLGRPSZ(tbl->groups));
1583 rcu_assign_pointer(tbl->listeners, new); 1583 rcu_assign_pointer(tbl->listeners, new);
1584 1584