All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wei Wang <weiwan@google.com>
To: David Ahern <dsahern@gmail.com>
Cc: stranche@codeaurora.org, 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: Tue, 5 Jan 2021 11:09:43 -0800	[thread overview]
Message-ID: <CAEA6p_CfmJZuYy7msGm0hi813q92hO2daC_zEZhhj0y3FYJ4LA@mail.gmail.com> (raw)
In-Reply-To: <5905440c-163a-d13e-933e-c9273445a6ed@gmail.com>

On Mon, Jan 4, 2021 at 8:58 PM David Ahern <dsahern@gmail.com> wrote:
>
> 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.
>
Thanks for catching this!
Agree with this proposed fix.


> 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 19:10 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
2021-01-05 19:09                   ` Wei Wang [this message]
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=CAEA6p_CfmJZuYy7msGm0hi813q92hO2daC_zEZhhj0y3FYJ4LA@mail.gmail.com \
    --to=weiwan@google.com \
    --cc=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 \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.