aboutsummaryrefslogtreecommitdiffstats
path: root/net/decnet
diff options
context:
space:
mode:
authorYing Xue <ying.xue@windriver.com>2014-01-14 21:23:40 -0500
committerDavid S. Miller <davem@davemloft.net>2014-01-14 21:50:46 -0500
commitd4c5fba2f6c272ed687fe6351e5b20bc60cf24f0 (patch)
tree52c2a24ee3b90543b4a5e4d28b6fd513570f185e /net/decnet
parentd9ac62be5740272f495154469cc9f77feb8d541a (diff)
decnet: use __dev_get_by_index instead of dev_get_by_index to find interface
The following call chain we can identify that dn_cache_getroute() is protected under rtnl_lock. So if we use __dev_get_by_index() instead of dev_get_by_index() to find interface handlers in it, this would help us avoid to change interface reference counter. rtnetlink_rcv() rtnl_lock() netlink_rcv_skb() dn_cache_getroute() rtnl_unlock() Signed-off-by: Ying Xue <ying.xue@windriver.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/decnet')
-rw-r--r--net/decnet/dn_route.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/net/decnet/dn_route.c b/net/decnet/dn_route.c
index ad2efa5b861b..ce0cbbfe0f43 100644
--- a/net/decnet/dn_route.c
+++ b/net/decnet/dn_route.c
@@ -1666,12 +1666,8 @@ static int dn_cache_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh)
1666 1666
1667 if (fld.flowidn_iif) { 1667 if (fld.flowidn_iif) {
1668 struct net_device *dev; 1668 struct net_device *dev;
1669 if ((dev = dev_get_by_index(&init_net, fld.flowidn_iif)) == NULL) { 1669 dev = __dev_get_by_index(&init_net, fld.flowidn_iif);
1670 kfree_skb(skb); 1670 if (!dev || !dev->dn_ptr) {
1671 return -ENODEV;
1672 }
1673 if (!dev->dn_ptr) {
1674 dev_put(dev);
1675 kfree_skb(skb); 1671 kfree_skb(skb);
1676 return -ENODEV; 1672 return -ENODEV;
1677 } 1673 }
@@ -1693,8 +1689,6 @@ static int dn_cache_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh)
1693 err = dn_route_output_key((struct dst_entry **)&rt, &fld, 0); 1689 err = dn_route_output_key((struct dst_entry **)&rt, &fld, 0);
1694 } 1690 }
1695 1691
1696 if (skb->dev)
1697 dev_put(skb->dev);
1698 skb->dev = NULL; 1692 skb->dev = NULL;
1699 if (err) 1693 if (err)
1700 goto out_free; 1694 goto out_free;