All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ido Schimmel <idosch@nvidia.com>
To: Daehyeon Ko <4ncienth@gmail.com>
Cc: David Ahern <dsahern@kernel.org>,
	"David S . Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@kernel.org>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Simon Horman <horms@kernel.org>,
	Vladimir Vdovin <deliran@verdict.gg>,
	Donald Hunter <donald.hunter@gmail.com>,
	Amit Cohen <amcohen@nvidia.com>, Roopa Prabhu <roopa@nvidia.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net v2 3/3] ipv4: stop route notification sizing when nexthop group shrinks
Date: Sun, 4 Oct 2026 11:20:43 +0300	[thread overview]
Message-ID: <20261004082043.GB92032@shredder> (raw)
In-Reply-To: <1054fa46165bba1b473782fa41367804aa908e86.1790915964.git.4ncienth@gmail.com>

On Fri, Oct 02, 2026 at 01:51:00PM +0900, Daehyeon Ko wrote:
> Commit 680aea08e78c ("net: ipv4: Emit notification when fib
> hardware flags are changed") added an RCU-only fib_nlmsg_size() call
> for asynchronous hardware flag notifications.
> 
> fib_nlmsg_size() checks fib_info_num_path() before each iteration,
> then fib_info_nhc() independently reloads nh->nh_grp. If
> RTM_NEWNEXTHOP replaces a group with fewer paths between those loads,
> fib_info_nhc() returns NULL and fib_nexthop_nlmsg_size() dereferences
> it.
> 
> Stop sizing when the indexed path is absent. Nexthop groups are
> dense, so the current snapshot has no later path.
> 
> Fixes: 680aea08e78c ("net: ipv4: Emit notification when fib hardware flags are changed")
> Cc: stable@vger.kernel.org
> Assisted-by: LLM
> Signed-off-by: Daehyeon Ko <4ncienth@gmail.com>

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

A group can also grow between fib_nlmsg_size() and fib_dump_info(),
leading to the latter returning -EMSGSIZE and triggering the warning. It
requires nexthop_compat_mode being set, which I assume most operators
disable nowadays if they are using the nexthop API.

Fix with [1]. If v3 is required, include it as patch #4. Otherwise, wait
for this series to be applied before sending the fix (to prevent sashiko
from flagging the issues being fixed here).

diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c
index 6ab95e19b3cf..ef3b1ac08ff9 100644
--- a/net/ipv4/fib_trie.c
+++ b/net/ipv4/fib_trie.c
@@ -1079,8 +1079,6 @@ void fib_alias_hw_flags_set(struct net *net, const struct fib_rt_info *fri)
 
 	err = fib_dump_info(skb, 0, 0, RTM_NEWROUTE, fri, 0);
 	if (err < 0) {
-		/* -EMSGSIZE implies BUG in fib_nlmsg_size() */
-		WARN_ON(err == -EMSGSIZE);
 		kfree_skb(skb);
 		goto errout;
 	}


  reply	other threads:[~2026-10-04  8:21 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-02  4:50 [PATCH net v2 0/3] ipv4: handle nexthop group shrink races Daehyeon Ko
2026-10-02  4:50 ` [PATCH net v2 1/3] ipv4: stop PMTU walk when nexthop group shrinks Daehyeon Ko
2026-10-02  4:50 ` [PATCH net v2 2/3] ipv4: stop exception dump " Daehyeon Ko
2026-10-04  8:02   ` Ido Schimmel
2026-10-02  4:51 ` [PATCH net v2 3/3] ipv4: stop route notification sizing " Daehyeon Ko
2026-10-04  8:20   ` Ido Schimmel [this message]
2026-10-06 23:30 ` [PATCH net v2 0/3] ipv4: handle nexthop group shrink races 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=20261004082043.GB92032@shredder \
    --to=idosch@nvidia.com \
    --cc=4ncienth@gmail.com \
    --cc=amcohen@nvidia.com \
    --cc=davem@davemloft.net \
    --cc=deliran@verdict.gg \
    --cc=donald.hunter@gmail.com \
    --cc=dsahern@kernel.org \
    --cc=edumazet@kernel.org \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=roopa@nvidia.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.