diff options
author | Florian Westphal <fw@strlen.de> | 2017-08-15 16:34:42 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-08-15 17:20:54 -0700 |
commit | 121622dba8da9c709b72d801eae7664fa7da7c36 (patch) | |
tree | 9f0772a6804300fc167cc11b682c59583e9acd74 /net/ipv6/route.c | |
parent | 2cc7659545bbf5e87795726cb15d09827c6f0fa6 (diff) | |
download | linux-121622dba8da9c709b72d801eae7664fa7da7c36.tar.bz2 |
ipv6: route: make rtm_getroute not assume rtnl is locked
__dev_get_by_index assumes RTNL is held, use _rcu version instead.
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/route.c')
-rw-r--r-- | net/ipv6/route.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/net/ipv6/route.c b/net/ipv6/route.c index 6793135d49db..60705b4d2c62 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c @@ -3611,8 +3611,11 @@ static int inet6_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh, struct net_device *dev; int flags = 0; - dev = __dev_get_by_index(net, iif); + rcu_read_lock(); + + dev = dev_get_by_index_rcu(net, iif); if (!dev) { + rcu_read_unlock(); err = -ENODEV; goto errout; } @@ -3624,6 +3627,8 @@ static int inet6_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh, if (!fibmatch) dst = ip6_route_input_lookup(net, dev, &fl6, flags); + + rcu_read_unlock(); } else { fl6.flowi6_oif = oif; |