diff options
author | Eric Dumazet <edumazet@google.com> | 2022-02-04 21:15:46 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2022-02-05 16:20:34 +0100 |
commit | f2f2325ec79970807012dfc9e716cdbb02d9b574 (patch) | |
tree | afa422a186e6a6e198150f0f87bd202d539b2c7d /net/ipv6/ip6mr.c | |
parent | ipv6: make mc_forwarding atomic (diff) | |
download | linux-f2f2325ec79970807012dfc9e716cdbb02d9b574.tar.xz 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/ip6mr.c')
-rw-r--r-- | net/ipv6/ip6mr.c | 3 |
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)) { |