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>,
Kuniyuki Iwashima <kuni1840@gmail.com>,
netdev@vger.kernel.org
Subject: Re: [PATCH v1 net-next 1/5] ipv4: fib: Flush all fib_info in fib_table_flush() during netns dismantle.
Date: Mon, 15 Jun 2026 15:38:15 +0300 [thread overview]
Message-ID: <20260615123815.GA485439@shredder> (raw)
In-Reply-To: <20260612063225.455191-2-kuniyu@google.com>
On Fri, Jun 12, 2026 at 06:32:04AM +0000, Kuniyuki Iwashima wrote:
> Even when fib_table_flush() is called with flush_all true, it does
> not flush all fib_info due to this condition:
>
> !(fi->fib_flags & RTNH_F_DEAD) && !fib_props[fa->fa_type].error)
>
> This creates an implicit ordering between default_device_exit_batch()
> and fib_net_exit_batch().
>
> fib_table_flush(flush_all=true) must be called after all devices
> are NETDEV_UNREGISTERed, which is after nexthop_flush_dev() marks
> RTNH_F_DEAD.
Nit: That's for nexthop objects. For the legacy API, the flag is set by
fib_sync_down_dev().
>
> This would cause memory leak if the order were reversed.
>
> fib_table_flush() does not skip non-dead error routes when flush_all
> is true:
>
> !flush_all &&
> !(fi->fib_flags & RTNH_F_DEAD) && fib_props[fa->fa_type].error
>
> Let's merge the two conditions not to skip all non-dead fib_info
> during netns dismantle.
>
> Note that we could further apply !flush_all to the basic table
> id check and the rtmsg_fib() call in the loop.
>
> Signed-off-by: Kuniyuki Iwashima <kuniyu@google.com>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
next prev parent reply other threads:[~2026-06-15 12:38 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-12 6:32 [PATCH v1 net-next 0/5] ipv4: fib: Remove RTNL in fib_net_exit_batch() Kuniyuki Iwashima
2026-06-12 6:32 ` [PATCH v1 net-next 1/5] ipv4: fib: Flush all fib_info in fib_table_flush() during netns dismantle Kuniyuki Iwashima
2026-06-15 12:38 ` Ido Schimmel [this message]
2026-06-12 6:32 ` [PATCH v1 net-next 2/5] ipv4: fib: Call fib_proc_exit() and nl_fib_lookup_exit() at ->pre_exit() Kuniyuki Iwashima
2026-06-15 12:38 ` Ido Schimmel
2026-06-12 6:32 ` [PATCH v1 net-next 3/5] ipv4: fib: Free net->ipv4.{fib_table_hash,notifier_ops} without RTNL Kuniyuki Iwashima
2026-06-15 12:38 ` Ido Schimmel
2026-06-12 6:32 ` [PATCH v1 net-next 4/5] ipv4: fib: Avoid calling fib_trie_table() in fib_new_table() for dying net Kuniyuki Iwashima
2026-06-15 12:39 ` Ido Schimmel
2026-06-12 6:32 ` [PATCH v1 net-next 5/5] ipv4: fib: Convert fib_net_exit_batch() to ->exit_rtnl() Kuniyuki Iwashima
2026-06-15 12:39 ` Ido Schimmel
2026-06-15 12:46 ` [PATCH v1 net-next 0/5] ipv4: fib: Remove RTNL in fib_net_exit_batch() Eric Dumazet
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=20260615123815.GA485439@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=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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox