Skip to content

Commit

Permalink
ipv6: route: make rtm_getroute not assume rtnl is locked
Browse files Browse the repository at this point in the history
__dev_get_by_index assumes RTNL is held, use _rcu version instead.

Signed-off-by: Florian Westphal <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Florian Westphal authored and davem330 committed Aug 16, 2017
1 parent 2cc7659 commit 121622d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion net/ipv6/route.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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;

Expand Down

0 comments on commit 121622d

Please sign in to comment.