diff options
author | Eric Dumazet <eric.dumazet@gmail.com> | 2011-08-11 15:30:52 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-08-12 05:55:28 -0400 |
commit | 33d480ce6d43326e2541fd79b3548858a174ec3c (patch) | |
tree | c938ee8c07a2e0f33178069b55439a54188f38fa /net/ipv4 | |
parent | cd28ca0a3dd17c68d24b839602a0e6268ad28b5d (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/ipv4')
-rw-r--r-- | net/ipv4/ipmr.c | 4 | ||||
-rw-r--r-- | net/ipv4/route.c | 6 | ||||
-rw-r--r-- | net/ipv4/udp.c | 7 |
3 files changed, 8 insertions, 9 deletions
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)) |