commit 9634257773c30ce13d74fa4918329612c60d84a8 Author: Francesco Ruggeri <frugg...@arista.com> Date: Mon Nov 6 11:01:59 2017 -0800
ipv6: try not to take rtnl_lock in ip6mr_sk_done mrt->mroute6_sk can only be set to a non-NULL value in ip6mr_sk_init() if sk->sk_type == SOCK_RAW && inet_sk(sk)->inet_num == IPPROTO_ICMPV6. Use that not to unnecessarily take the rtn_lock in ip6mr_sk_done() when it is invoked from rawv6_close(). Signed-off-by: Francesco Ruggeri <frugg...@arista.com> diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c index f5500f5..e1bb2d8 100644 --- a/net/ipv6/ip6mr.c +++ b/net/ipv6/ip6mr.c @@ -1617,6 +1617,10 @@ int ip6mr_sk_done(struct sock *sk) struct net *net = sock_net(sk); struct mr6_table *mrt; + if (sk->sk_type != SOCK_RAW || + inet_sk(sk)->inet_num != IPPROTO_ICMPV6) + return err; + rtnl_lock(); ip6mr_for_each_table(mrt, net) { if (sk == mrt->mroute6_sk) {