[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20171106204059.AED8940382@fruggeri-Arora18_1.sjc.aristanetworks.com>
Date: Mon, 06 Nov 2017 12:40:59 -0800
From: fruggeri@...sta.com (Francesco Ruggeri)
To: yoshfuji@...ux-ipv6.org, kuznet@....inr.ac.ru, davem@...emloft.net,
fruggeri@...sta.com, netdev@...r.kernel.org
Subject: [PATCH] ipv6: try not to take rtnl_lock in ip6mr_sk_done
commit 9634257773c30ce13d74fa4918329612c60d84a8
Author: Francesco Ruggeri <fruggeri@...sta.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 <fruggeri@...sta.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) {
Powered by blists - more mailing lists