diff options
Diffstat (limited to 'net/decnet/dn_route.c')
-rw-r--r-- | net/decnet/dn_route.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/net/decnet/dn_route.c b/net/decnet/dn_route.c index 57662cabaf9b..70ebe74027d5 100644 --- a/net/decnet/dn_route.c +++ b/net/decnet/dn_route.c | |||
@@ -66,6 +66,7 @@ | |||
66 | #include <linux/inet.h> | 66 | #include <linux/inet.h> |
67 | #include <linux/route.h> | 67 | #include <linux/route.h> |
68 | #include <linux/in_route.h> | 68 | #include <linux/in_route.h> |
69 | #include <linux/slab.h> | ||
69 | #include <net/sock.h> | 70 | #include <net/sock.h> |
70 | #include <linux/mm.h> | 71 | #include <linux/mm.h> |
71 | #include <linux/proc_fs.h> | 72 | #include <linux/proc_fs.h> |
@@ -908,8 +909,8 @@ static int dn_route_output_slow(struct dst_entry **pprt, const struct flowi *old | |||
908 | dev_put(dev_out); | 909 | dev_put(dev_out); |
909 | goto out; | 910 | goto out; |
910 | } | 911 | } |
911 | read_lock(&dev_base_lock); | 912 | rcu_read_lock(); |
912 | for_each_netdev(&init_net, dev) { | 913 | for_each_netdev_rcu(&init_net, dev) { |
913 | if (!dev->dn_ptr) | 914 | if (!dev->dn_ptr) |
914 | continue; | 915 | continue; |
915 | if (!dn_dev_islocal(dev, oldflp->fld_src)) | 916 | if (!dn_dev_islocal(dev, oldflp->fld_src)) |
@@ -922,7 +923,7 @@ static int dn_route_output_slow(struct dst_entry **pprt, const struct flowi *old | |||
922 | dev_out = dev; | 923 | dev_out = dev; |
923 | break; | 924 | break; |
924 | } | 925 | } |
925 | read_unlock(&dev_base_lock); | 926 | rcu_read_unlock(); |
926 | if (dev_out == NULL) | 927 | if (dev_out == NULL) |
927 | goto out; | 928 | goto out; |
928 | dev_hold(dev_out); | 929 | dev_hold(dev_out); |
@@ -1155,8 +1156,8 @@ static int __dn_route_output_key(struct dst_entry **pprt, const struct flowi *fl | |||
1155 | 1156 | ||
1156 | if (!(flags & MSG_TRYHARD)) { | 1157 | if (!(flags & MSG_TRYHARD)) { |
1157 | rcu_read_lock_bh(); | 1158 | rcu_read_lock_bh(); |
1158 | for(rt = rcu_dereference(dn_rt_hash_table[hash].chain); rt; | 1159 | for (rt = rcu_dereference_bh(dn_rt_hash_table[hash].chain); rt; |
1159 | rt = rcu_dereference(rt->u.dst.dn_next)) { | 1160 | rt = rcu_dereference_bh(rt->u.dst.dn_next)) { |
1160 | if ((flp->fld_dst == rt->fl.fld_dst) && | 1161 | if ((flp->fld_dst == rt->fl.fld_dst) && |
1161 | (flp->fld_src == rt->fl.fld_src) && | 1162 | (flp->fld_src == rt->fl.fld_src) && |
1162 | (flp->mark == rt->fl.mark) && | 1163 | (flp->mark == rt->fl.mark) && |
@@ -1517,7 +1518,7 @@ static int dn_cache_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh, void | |||
1517 | struct sk_buff *skb; | 1518 | struct sk_buff *skb; |
1518 | struct flowi fl; | 1519 | struct flowi fl; |
1519 | 1520 | ||
1520 | if (net != &init_net) | 1521 | if (!net_eq(net, &init_net)) |
1521 | return -EINVAL; | 1522 | return -EINVAL; |
1522 | 1523 | ||
1523 | memset(&fl, 0, sizeof(fl)); | 1524 | memset(&fl, 0, sizeof(fl)); |
@@ -1602,7 +1603,7 @@ int dn_cache_dump(struct sk_buff *skb, struct netlink_callback *cb) | |||
1602 | int h, s_h; | 1603 | int h, s_h; |
1603 | int idx, s_idx; | 1604 | int idx, s_idx; |
1604 | 1605 | ||
1605 | if (net != &init_net) | 1606 | if (!net_eq(net, &init_net)) |
1606 | return 0; | 1607 | return 0; |
1607 | 1608 | ||
1608 | if (NLMSG_PAYLOAD(cb->nlh, 0) < sizeof(struct rtmsg)) | 1609 | if (NLMSG_PAYLOAD(cb->nlh, 0) < sizeof(struct rtmsg)) |
@@ -1618,9 +1619,9 @@ int dn_cache_dump(struct sk_buff *skb, struct netlink_callback *cb) | |||
1618 | if (h > s_h) | 1619 | if (h > s_h) |
1619 | s_idx = 0; | 1620 | s_idx = 0; |
1620 | rcu_read_lock_bh(); | 1621 | rcu_read_lock_bh(); |
1621 | for(rt = rcu_dereference(dn_rt_hash_table[h].chain), idx = 0; | 1622 | for(rt = rcu_dereference_bh(dn_rt_hash_table[h].chain), idx = 0; |
1622 | rt; | 1623 | rt; |
1623 | rt = rcu_dereference(rt->u.dst.dn_next), idx++) { | 1624 | rt = rcu_dereference_bh(rt->u.dst.dn_next), idx++) { |
1624 | if (idx < s_idx) | 1625 | if (idx < s_idx) |
1625 | continue; | 1626 | continue; |
1626 | skb_dst_set(skb, dst_clone(&rt->u.dst)); | 1627 | skb_dst_set(skb, dst_clone(&rt->u.dst)); |
@@ -1654,12 +1655,12 @@ static struct dn_route *dn_rt_cache_get_first(struct seq_file *seq) | |||
1654 | 1655 | ||
1655 | for(s->bucket = dn_rt_hash_mask; s->bucket >= 0; --s->bucket) { | 1656 | for(s->bucket = dn_rt_hash_mask; s->bucket >= 0; --s->bucket) { |
1656 | rcu_read_lock_bh(); | 1657 | rcu_read_lock_bh(); |
1657 | rt = dn_rt_hash_table[s->bucket].chain; | 1658 | rt = rcu_dereference_bh(dn_rt_hash_table[s->bucket].chain); |
1658 | if (rt) | 1659 | if (rt) |
1659 | break; | 1660 | break; |
1660 | rcu_read_unlock_bh(); | 1661 | rcu_read_unlock_bh(); |
1661 | } | 1662 | } |
1662 | return rcu_dereference(rt); | 1663 | return rt; |
1663 | } | 1664 | } |
1664 | 1665 | ||
1665 | static struct dn_route *dn_rt_cache_get_next(struct seq_file *seq, struct dn_route *rt) | 1666 | static struct dn_route *dn_rt_cache_get_next(struct seq_file *seq, struct dn_route *rt) |
@@ -1674,7 +1675,7 @@ static struct dn_route *dn_rt_cache_get_next(struct seq_file *seq, struct dn_rou | |||
1674 | rcu_read_lock_bh(); | 1675 | rcu_read_lock_bh(); |
1675 | rt = dn_rt_hash_table[s->bucket].chain; | 1676 | rt = dn_rt_hash_table[s->bucket].chain; |
1676 | } | 1677 | } |
1677 | return rcu_dereference(rt); | 1678 | return rcu_dereference_bh(rt); |
1678 | } | 1679 | } |
1679 | 1680 | ||
1680 | static void *dn_rt_cache_seq_start(struct seq_file *seq, loff_t *pos) | 1681 | static void *dn_rt_cache_seq_start(struct seq_file *seq, loff_t *pos) |