netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Ahern <dsahern@gmail.com>
To: stranche@codeaurora.org
Cc: Wei Wang <weiwan@google.com>,
	Eric Dumazet <eric.dumazet@gmail.com>,
	Martin KaFai Lau <kafai@fb.com>,
	Mahesh Bandewar <maheshb@google.com>,
	Jakub Kicinski <kuba@kernel.org>,
	Linux Kernel Network Developers <netdev@vger.kernel.org>,
	Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
Subject: Re: Refcount mismatch when unregistering netdevice from kernel
Date: Mon, 4 Jan 2021 21:58:01 -0700	[thread overview]
Message-ID: <5905440c-163a-d13e-933e-c9273445a6ed@gmail.com> (raw)
In-Reply-To: <9f25d75823a73c6f0f556f0905f931d1@codeaurora.org>

On 1/4/21 8:05 PM, stranche@codeaurora.org wrote:
> 
> We're able to reproduce the refcount mismatch after some experimentation
> as well.
> Essentially, it consists of
> 1) adding a default route (ip -6 route add dev XXX default)
> 2) forcing the creation of an exception route via manually injecting an
> ICMPv6
> Packet Too Big into the device.
> 3) Replace the default route (ip -6 route change dev XXX default)
> 4) Delete the device. (ip link del XXX)
> 
> After adding a call to flush out the exception cache for the route, the
> mismatch
> is no longer seen:
> diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c
> index 7a0c877..95e4310 100644
> --- a/net/ipv6/ip6_fib.c
> +++ b/net/ipv6/ip6_fib.c
> @@ -1215,6 +1215,7 @@ static int fib6_add_rt2node(struct fib6_node *fn,
> struct fib6_info *rt,
>                 }
>                 nsiblings = iter->fib6_nsiblings;
>                 iter->fib6_node = NULL;
> +               rt6_flush_exceptions(iter);
>                 fib6_purge_rt(iter, fn, info->nl_net);
>                 if (rcu_access_pointer(fn->rr_ptr) == iter)
>                         fn->rr_ptr = NULL;

Ah, I see now. rt6_flush_exceptions is called by fib6_del_route, but
that won't handle replace.

If you look at fib6_purge_rt it already has a call to remove pcpu
entries. This call to flush exceptions should go there and the existing
one in fib6_del_route can be removed.

Also, can you add the reproducer as another test case to
tools/testing/selftests/net/pmtu.sh? We definitely need one for this
sequence (route, exceptions, replace route).

  reply	other threads:[~2021-01-05  4:58 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-08  3:55 Refcount mismatch when unregistering netdevice from kernel stranche
2020-12-08 15:08 ` Eric Dumazet
2020-12-08 18:09   ` Wei Wang
2020-12-08 19:12     ` stranche
2020-12-08 21:51       ` Wei Wang
2020-12-09  0:03         ` David Ahern
2020-12-11  1:12           ` stranche
2020-12-11 16:10             ` David Ahern
2021-01-05  3:05               ` stranche
2021-01-05  4:58                 ` David Ahern [this message]
2021-01-05 19:09                   ` Wei Wang
2021-02-11 19:21                     ` Alexei Starovoitov
2021-02-12  1:28                       ` Jakub Kicinski
2021-02-12  1:44                         ` Alexei Starovoitov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5905440c-163a-d13e-933e-c9273445a6ed@gmail.com \
    --to=dsahern@gmail.com \
    --cc=eric.dumazet@gmail.com \
    --cc=kafai@fb.com \
    --cc=kuba@kernel.org \
    --cc=maheshb@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=stranche@codeaurora.org \
    --cc=subashab@codeaurora.org \
    --cc=weiwan@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).