aboutsummaryrefslogtreecommitdiff
path: root/net/ipv6
diff options
context:
space:
mode:
authorGravatar Eric Dumazet <edumazet@google.com> 2022-02-04 12:15:46 -0800
committerGravatar David S. Miller <davem@davemloft.net> 2022-02-05 15:20:34 +0000
commitf2f2325ec79970807012dfc9e716cdbb02d9b574 (patch)
treeafa422a186e6a6e198150f0f87bd202d539b2c7d /net/ipv6
parentipv6: make mc_forwarding atomic (diff)
downloadlinux-f2f2325ec79970807012dfc9e716cdbb02d9b574.tar.gz
linux-f2f2325ec79970807012dfc9e716cdbb02d9b574.tar.bz2
linux-f2f2325ec79970807012dfc9e716cdbb02d9b574.zip
ip6mr: ip6mr_sk_done() can exit early in common cases
In many cases, ip6mr_sk_done() is called while no ipmr socket has been registered. This removes 4 rtnl acquisitions per netns dismantle, with following callers: igmp6_net_exit(), tcpv6_net_exit(), ndisc_net_exit() Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6')
-rw-r--r--net/ipv6/ip6mr.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c
index 541cd0887129..8e483e14b570 100644
--- a/net/ipv6/ip6mr.c
+++ b/net/ipv6/ip6mr.c
@@ -1575,6 +1575,9 @@ int ip6mr_sk_done(struct sock *sk)
inet_sk(sk)->inet_num != IPPROTO_ICMPV6)
return err;
+ if (!atomic_read(&net->ipv6.devconf_all->mc_forwarding))
+ return err;
+
rtnl_lock();
ip6mr_for_each_table(mrt, net) {
if (sk == rtnl_dereference(mrt->mroute_sk)) {