diff options
-rw-r--r-- | include/linux/rtnetlink.h | 3 | ||||
-rw-r--r-- | include/net/addrconf.h | 4 | ||||
-rw-r--r-- | net/core/dev.c | 2 | ||||
-rw-r--r-- | net/core/filter.c | 6 | ||||
-rw-r--r-- | net/core/rtnetlink.c | 8 | ||||
-rw-r--r-- | net/core/sock.c | 3 | ||||
-rw-r--r-- | net/decnet/dn_route.c | 14 | ||||
-rw-r--r-- | net/ipv4/route.c | 14 | ||||
-rw-r--r-- | net/packet/af_packet.c | 2 |
9 files changed, 35 insertions, 21 deletions
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h index 05330fc5b436..5c52fa43785c 100644 --- a/include/linux/rtnetlink.h +++ b/include/linux/rtnetlink.h | |||
@@ -735,6 +735,9 @@ extern void rtnl_lock(void); | |||
735 | extern void rtnl_unlock(void); | 735 | extern void rtnl_unlock(void); |
736 | extern int rtnl_trylock(void); | 736 | extern int rtnl_trylock(void); |
737 | extern int rtnl_is_locked(void); | 737 | extern int rtnl_is_locked(void); |
738 | #ifdef CONFIG_PROVE_LOCKING | ||
739 | extern int lockdep_rtnl_is_held(void); | ||
740 | #endif /* #ifdef CONFIG_PROVE_LOCKING */ | ||
738 | 741 | ||
739 | extern void rtnetlink_init(void); | 742 | extern void rtnetlink_init(void); |
740 | extern void __rtnl_unlock(void); | 743 | extern void __rtnl_unlock(void); |
diff --git a/include/net/addrconf.h b/include/net/addrconf.h index 0f7c37825fc1..45375b41a2a0 100644 --- a/include/net/addrconf.h +++ b/include/net/addrconf.h | |||
@@ -177,7 +177,9 @@ extern int unregister_inet6addr_notifier(struct notifier_block *nb); | |||
177 | static inline struct inet6_dev * | 177 | static inline struct inet6_dev * |
178 | __in6_dev_get(struct net_device *dev) | 178 | __in6_dev_get(struct net_device *dev) |
179 | { | 179 | { |
180 | return rcu_dereference(dev->ip6_ptr); | 180 | return rcu_dereference_check(dev->ip6_ptr, |
181 | rcu_read_lock_held() || | ||
182 | lockdep_rtnl_is_held()); | ||
181 | } | 183 | } |
182 | 184 | ||
183 | static inline struct inet6_dev * | 185 | static inline struct inet6_dev * |
diff --git a/net/core/dev.c b/net/core/dev.c index ec874218b206..bb1f1da2b8a7 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -2041,7 +2041,7 @@ gso: | |||
2041 | rcu_read_lock_bh(); | 2041 | rcu_read_lock_bh(); |
2042 | 2042 | ||
2043 | txq = dev_pick_tx(dev, skb); | 2043 | txq = dev_pick_tx(dev, skb); |
2044 | q = rcu_dereference(txq->qdisc); | 2044 | q = rcu_dereference_bh(txq->qdisc); |
2045 | 2045 | ||
2046 | #ifdef CONFIG_NET_CLS_ACT | 2046 | #ifdef CONFIG_NET_CLS_ACT |
2047 | skb->tc_verd = SET_TC_AT(skb->tc_verd, AT_EGRESS); | 2047 | skb->tc_verd = SET_TC_AT(skb->tc_verd, AT_EGRESS); |
diff --git a/net/core/filter.c b/net/core/filter.c index 08db7b9143a3..3541aa48d21d 100644 --- a/net/core/filter.c +++ b/net/core/filter.c | |||
@@ -86,7 +86,7 @@ int sk_filter(struct sock *sk, struct sk_buff *skb) | |||
86 | return err; | 86 | return err; |
87 | 87 | ||
88 | rcu_read_lock_bh(); | 88 | rcu_read_lock_bh(); |
89 | filter = rcu_dereference(sk->sk_filter); | 89 | filter = rcu_dereference_bh(sk->sk_filter); |
90 | if (filter) { | 90 | if (filter) { |
91 | unsigned int pkt_len = sk_run_filter(skb, filter->insns, | 91 | unsigned int pkt_len = sk_run_filter(skb, filter->insns, |
92 | filter->len); | 92 | filter->len); |
@@ -521,7 +521,7 @@ int sk_attach_filter(struct sock_fprog *fprog, struct sock *sk) | |||
521 | } | 521 | } |
522 | 522 | ||
523 | rcu_read_lock_bh(); | 523 | rcu_read_lock_bh(); |
524 | old_fp = rcu_dereference(sk->sk_filter); | 524 | old_fp = rcu_dereference_bh(sk->sk_filter); |
525 | rcu_assign_pointer(sk->sk_filter, fp); | 525 | rcu_assign_pointer(sk->sk_filter, fp); |
526 | rcu_read_unlock_bh(); | 526 | rcu_read_unlock_bh(); |
527 | 527 | ||
@@ -536,7 +536,7 @@ int sk_detach_filter(struct sock *sk) | |||
536 | struct sk_filter *filter; | 536 | struct sk_filter *filter; |
537 | 537 | ||
538 | rcu_read_lock_bh(); | 538 | rcu_read_lock_bh(); |
539 | filter = rcu_dereference(sk->sk_filter); | 539 | filter = rcu_dereference_bh(sk->sk_filter); |
540 | if (filter) { | 540 | if (filter) { |
541 | rcu_assign_pointer(sk->sk_filter, NULL); | 541 | rcu_assign_pointer(sk->sk_filter, NULL); |
542 | sk_filter_delayed_uncharge(sk, filter); | 542 | sk_filter_delayed_uncharge(sk, filter); |
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index 794bcb897ff0..4c7d3f635ba7 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c | |||
@@ -89,6 +89,14 @@ int rtnl_is_locked(void) | |||
89 | } | 89 | } |
90 | EXPORT_SYMBOL(rtnl_is_locked); | 90 | EXPORT_SYMBOL(rtnl_is_locked); |
91 | 91 | ||
92 | #ifdef CONFIG_PROVE_LOCKING | ||
93 | int lockdep_rtnl_is_held(void) | ||
94 | { | ||
95 | return lockdep_is_held(&rtnl_mutex); | ||
96 | } | ||
97 | EXPORT_SYMBOL(lockdep_rtnl_is_held); | ||
98 | #endif /* #ifdef CONFIG_PROVE_LOCKING */ | ||
99 | |||
92 | static struct rtnl_link *rtnl_msg_handlers[NPROTO]; | 100 | static struct rtnl_link *rtnl_msg_handlers[NPROTO]; |
93 | 101 | ||
94 | static inline int rtm_msgindex(int msgtype) | 102 | static inline int rtm_msgindex(int msgtype) |
diff --git a/net/core/sock.c b/net/core/sock.c index e1f6f225f012..305cba401ae6 100644 --- a/net/core/sock.c +++ b/net/core/sock.c | |||
@@ -1073,7 +1073,8 @@ static void __sk_free(struct sock *sk) | |||
1073 | if (sk->sk_destruct) | 1073 | if (sk->sk_destruct) |
1074 | sk->sk_destruct(sk); | 1074 | sk->sk_destruct(sk); |
1075 | 1075 | ||
1076 | filter = rcu_dereference(sk->sk_filter); | 1076 | filter = rcu_dereference_check(sk->sk_filter, |
1077 | atomic_read(&sk->sk_wmem_alloc) == 0); | ||
1077 | if (filter) { | 1078 | if (filter) { |
1078 | sk_filter_uncharge(sk, filter); | 1079 | sk_filter_uncharge(sk, filter); |
1079 | rcu_assign_pointer(sk->sk_filter, NULL); | 1080 | rcu_assign_pointer(sk->sk_filter, NULL); |
diff --git a/net/decnet/dn_route.c b/net/decnet/dn_route.c index a03284061a31..a7bf03ca0a36 100644 --- a/net/decnet/dn_route.c +++ b/net/decnet/dn_route.c | |||
@@ -1155,8 +1155,8 @@ static int __dn_route_output_key(struct dst_entry **pprt, const struct flowi *fl | |||
1155 | 1155 | ||
1156 | if (!(flags & MSG_TRYHARD)) { | 1156 | if (!(flags & MSG_TRYHARD)) { |
1157 | rcu_read_lock_bh(); | 1157 | rcu_read_lock_bh(); |
1158 | for(rt = rcu_dereference(dn_rt_hash_table[hash].chain); rt; | 1158 | for (rt = rcu_dereference_bh(dn_rt_hash_table[hash].chain); rt; |
1159 | rt = rcu_dereference(rt->u.dst.dn_next)) { | 1159 | rt = rcu_dereference_bh(rt->u.dst.dn_next)) { |
1160 | if ((flp->fld_dst == rt->fl.fld_dst) && | 1160 | if ((flp->fld_dst == rt->fl.fld_dst) && |
1161 | (flp->fld_src == rt->fl.fld_src) && | 1161 | (flp->fld_src == rt->fl.fld_src) && |
1162 | (flp->mark == rt->fl.mark) && | 1162 | (flp->mark == rt->fl.mark) && |
@@ -1618,9 +1618,9 @@ int dn_cache_dump(struct sk_buff *skb, struct netlink_callback *cb) | |||
1618 | if (h > s_h) | 1618 | if (h > s_h) |
1619 | s_idx = 0; | 1619 | s_idx = 0; |
1620 | rcu_read_lock_bh(); | 1620 | rcu_read_lock_bh(); |
1621 | for(rt = rcu_dereference(dn_rt_hash_table[h].chain), idx = 0; | 1621 | for(rt = rcu_dereference_bh(dn_rt_hash_table[h].chain), idx = 0; |
1622 | rt; | 1622 | rt; |
1623 | rt = rcu_dereference(rt->u.dst.dn_next), idx++) { | 1623 | rt = rcu_dereference_bh(rt->u.dst.dn_next), idx++) { |
1624 | if (idx < s_idx) | 1624 | if (idx < s_idx) |
1625 | continue; | 1625 | continue; |
1626 | skb_dst_set(skb, dst_clone(&rt->u.dst)); | 1626 | skb_dst_set(skb, dst_clone(&rt->u.dst)); |
@@ -1654,12 +1654,12 @@ static struct dn_route *dn_rt_cache_get_first(struct seq_file *seq) | |||
1654 | 1654 | ||
1655 | for(s->bucket = dn_rt_hash_mask; s->bucket >= 0; --s->bucket) { | 1655 | for(s->bucket = dn_rt_hash_mask; s->bucket >= 0; --s->bucket) { |
1656 | rcu_read_lock_bh(); | 1656 | rcu_read_lock_bh(); |
1657 | rt = dn_rt_hash_table[s->bucket].chain; | 1657 | rt = rcu_dereference_bh(dn_rt_hash_table[s->bucket].chain); |
1658 | if (rt) | 1658 | if (rt) |
1659 | break; | 1659 | break; |
1660 | rcu_read_unlock_bh(); | 1660 | rcu_read_unlock_bh(); |
1661 | } | 1661 | } |
1662 | return rcu_dereference(rt); | 1662 | return rt; |
1663 | } | 1663 | } |
1664 | 1664 | ||
1665 | static struct dn_route *dn_rt_cache_get_next(struct seq_file *seq, struct dn_route *rt) | 1665 | static struct dn_route *dn_rt_cache_get_next(struct seq_file *seq, struct dn_route *rt) |
@@ -1674,7 +1674,7 @@ static struct dn_route *dn_rt_cache_get_next(struct seq_file *seq, struct dn_rou | |||
1674 | rcu_read_lock_bh(); | 1674 | rcu_read_lock_bh(); |
1675 | rt = dn_rt_hash_table[s->bucket].chain; | 1675 | rt = dn_rt_hash_table[s->bucket].chain; |
1676 | } | 1676 | } |
1677 | return rcu_dereference(rt); | 1677 | return rcu_dereference_bh(rt); |
1678 | } | 1678 | } |
1679 | 1679 | ||
1680 | static void *dn_rt_cache_seq_start(struct seq_file *seq, loff_t *pos) | 1680 | static void *dn_rt_cache_seq_start(struct seq_file *seq, loff_t *pos) |
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index d62b05d33384..4f11faa5c824 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c | |||
@@ -287,12 +287,12 @@ static struct rtable *rt_cache_get_first(struct seq_file *seq) | |||
287 | if (!rt_hash_table[st->bucket].chain) | 287 | if (!rt_hash_table[st->bucket].chain) |
288 | continue; | 288 | continue; |
289 | rcu_read_lock_bh(); | 289 | rcu_read_lock_bh(); |
290 | r = rcu_dereference(rt_hash_table[st->bucket].chain); | 290 | r = rcu_dereference_bh(rt_hash_table[st->bucket].chain); |
291 | while (r) { | 291 | while (r) { |
292 | if (dev_net(r->u.dst.dev) == seq_file_net(seq) && | 292 | if (dev_net(r->u.dst.dev) == seq_file_net(seq) && |
293 | r->rt_genid == st->genid) | 293 | r->rt_genid == st->genid) |
294 | return r; | 294 | return r; |
295 | r = rcu_dereference(r->u.dst.rt_next); | 295 | r = rcu_dereference_bh(r->u.dst.rt_next); |
296 | } | 296 | } |
297 | rcu_read_unlock_bh(); | 297 | rcu_read_unlock_bh(); |
298 | } | 298 | } |
@@ -314,7 +314,7 @@ static struct rtable *__rt_cache_get_next(struct seq_file *seq, | |||
314 | rcu_read_lock_bh(); | 314 | rcu_read_lock_bh(); |
315 | r = rt_hash_table[st->bucket].chain; | 315 | r = rt_hash_table[st->bucket].chain; |
316 | } | 316 | } |
317 | return rcu_dereference(r); | 317 | return rcu_dereference_bh(r); |
318 | } | 318 | } |
319 | 319 | ||
320 | static struct rtable *rt_cache_get_next(struct seq_file *seq, | 320 | static struct rtable *rt_cache_get_next(struct seq_file *seq, |
@@ -2689,8 +2689,8 @@ int __ip_route_output_key(struct net *net, struct rtable **rp, | |||
2689 | hash = rt_hash(flp->fl4_dst, flp->fl4_src, flp->oif, rt_genid(net)); | 2689 | hash = rt_hash(flp->fl4_dst, flp->fl4_src, flp->oif, rt_genid(net)); |
2690 | 2690 | ||
2691 | rcu_read_lock_bh(); | 2691 | rcu_read_lock_bh(); |
2692 | for (rth = rcu_dereference(rt_hash_table[hash].chain); rth; | 2692 | for (rth = rcu_dereference_bh(rt_hash_table[hash].chain); rth; |
2693 | rth = rcu_dereference(rth->u.dst.rt_next)) { | 2693 | rth = rcu_dereference_bh(rth->u.dst.rt_next)) { |
2694 | if (rth->fl.fl4_dst == flp->fl4_dst && | 2694 | if (rth->fl.fl4_dst == flp->fl4_dst && |
2695 | rth->fl.fl4_src == flp->fl4_src && | 2695 | rth->fl.fl4_src == flp->fl4_src && |
2696 | rth->fl.iif == 0 && | 2696 | rth->fl.iif == 0 && |
@@ -3008,8 +3008,8 @@ int ip_rt_dump(struct sk_buff *skb, struct netlink_callback *cb) | |||
3008 | if (!rt_hash_table[h].chain) | 3008 | if (!rt_hash_table[h].chain) |
3009 | continue; | 3009 | continue; |
3010 | rcu_read_lock_bh(); | 3010 | rcu_read_lock_bh(); |
3011 | for (rt = rcu_dereference(rt_hash_table[h].chain), idx = 0; rt; | 3011 | for (rt = rcu_dereference_bh(rt_hash_table[h].chain), idx = 0; rt; |
3012 | rt = rcu_dereference(rt->u.dst.rt_next), idx++) { | 3012 | rt = rcu_dereference_bh(rt->u.dst.rt_next), idx++) { |
3013 | if (!net_eq(dev_net(rt->u.dst.dev), net) || idx < s_idx) | 3013 | if (!net_eq(dev_net(rt->u.dst.dev), net) || idx < s_idx) |
3014 | continue; | 3014 | continue; |
3015 | if (rt_is_expired(rt)) | 3015 | if (rt_is_expired(rt)) |
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c index f126d18dbdc4..939471ef8d50 100644 --- a/net/packet/af_packet.c +++ b/net/packet/af_packet.c | |||
@@ -508,7 +508,7 @@ static inline unsigned int run_filter(struct sk_buff *skb, struct sock *sk, | |||
508 | struct sk_filter *filter; | 508 | struct sk_filter *filter; |
509 | 509 | ||
510 | rcu_read_lock_bh(); | 510 | rcu_read_lock_bh(); |
511 | filter = rcu_dereference(sk->sk_filter); | 511 | filter = rcu_dereference_bh(sk->sk_filter); |
512 | if (filter != NULL) | 512 | if (filter != NULL) |
513 | res = sk_run_filter(skb, filter->insns, filter->len); | 513 | res = sk_run_filter(skb, filter->insns, filter->len); |
514 | rcu_read_unlock_bh(); | 514 | rcu_read_unlock_bh(); |