All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ido Schimmel <idosch@nvidia.com>
To: Kuniyuki Iwashima <kuniyu@google.com>
Cc: David Ahern <dsahern@kernel.org>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Simon Horman <horms@kernel.org>,
	Marc Harvey <marcharvey@google.com>,
	Kuniyuki Iwashima <kuni1840@gmail.com>,
	netdev@vger.kernel.org
Subject: Re: [PATCH v1 net] ipv6: Prevent rt6_insert_exception() for dying fib6_info.
Date: Sun, 20 Sep 2026 18:52:31 +0300	[thread overview]
Message-ID: <20260920155231.GA2014789@shredder> (raw)
In-Reply-To: <20260918082209.2853582-1-kuniyu@google.com>

On Fri, Sep 18, 2026 at 08:22:05AM +0000, Kuniyuki Iwashima wrote:
> Before the cited commit, fib6_nh_flush_exceptions() always set
> from->exception_bucket_flushed = 1 under rt6_exception_lock to
> prevent rt6_insert_exception() from inserting a new exception
> for a dying fib6_info.
> 
> The flag was replaced with the FIB6_EXCEPTION_BUCKET_FLUSHED
> bit stored in nh->rt6i_exception_bucket.
> 
> The problem is that now the bit is only set when the bucket
> is not NULL and fib6_nh_flush_exceptions() is called from
> fib6_nh_release() after fib6_ref has already reached zero.
> 
> If rt6_insert_exception() is called while the target fib6_info
> is being removed via fib6_purge_rt(), a new exception could be
> created successfully because rt6_flush_exceptions() no longer
> sets the bit.
> 
> This creates a reference cycle between the fib6_info and the
> exception route, leaking the fib6_info, its nexthop device,
> and all per-CPU routes in fib6_nh->rt6i_pcpu, which stalls netdev
> unregistration.
> 
> [   34.680602] unregister_netdevice: waiting for gre6 to become free. Usage count = 68
> [   44.920675] unregister_netdevice: waiting for gre6 to become free. Usage count = 68
> [   55.176582] unregister_netdevice: waiting for gre6 to become free. Usage count = 68
> 
> Let's call fib6_drop_pcpu_from() before rt6_flush_exceptions(),
> to set fib6_destroying before rt6_exception_lock, and check
> f6i->fib6_destroying in rt6_insert_exception().
> 
> Note that FIB6_EXCEPTION_BUCKET_FLUSHED logic is dead and
> we can clean it up in net-next.
> 
> Fixes: cc5c073a693f ("ipv6: Move exception bucket to fib6_nh")
> Signed-off-by: Kuniyuki Iwashima <kuniyu@google.com>

Looks OK, but if you need another version (or in net-next when you
remove FIB6_EXCEPTION_BUCKET_FLUSHED), then also update the comment in
fib6_drop_pcpu_from() to make it clear that 'fib6_destroying' also
prevents the addition of exception routes and not only per-CPU ones.

Reviewed-by: Ido Schimmel <idosch@nvidia.com>

  reply	other threads:[~2026-09-20 15:52 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-18  8:22 [PATCH v1 net] ipv6: Prevent rt6_insert_exception() for dying fib6_info Kuniyuki Iwashima
2026-09-20 15:52 ` Ido Schimmel [this message]
2026-09-21  8:24 ` netdev-bot+sashiko
2026-09-21 10:09   ` Ido Schimmel
2026-09-21 15:50     ` Kuniyuki Iwashima
2026-09-21 23:30 ` patchwork-bot+netdevbpf

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=20260920155231.GA2014789@shredder \
    --to=idosch@nvidia.com \
    --cc=davem@davemloft.net \
    --cc=dsahern@kernel.org \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=kuni1840@gmail.com \
    --cc=kuniyu@google.com \
    --cc=marcharvey@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.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 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.