Thread (7 messages) 7 messages, 3 authors, 4d ago

Re: [PATCH net v2 3/3] ipv4: stop route notification sizing when nexthop group shrinks

flat view

From: Ido Schimmel <idosch@nvidia.com>
Date: 2026-10-04 08:21:02
Also in: lkml
Subsystem: networking [general], networking [ipv4/ipv6], the rest · Maintainers: "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, David Ahern, Ido Schimmel, Linus Torvalds

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 <redacted>
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;
 	}
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help