Skip to contentSkip to conversation

ipv4/ipv6: do not warn on route notification size races

PATCH Applied Daehyeon Ko 3 participants 5 messages Oct 8

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v2 cover ipv4/ipv6: do not warn on route notification size races

A nexthop group can grow between route notification sizing and filling. Both IPv4 and IPv6 can then legitimately return -EMSGSIZE, so remove the stale warnings while preserving their existing error paths.

Patch 1 is unchanged from v1. Patch 2 adds the IPv6 counterpart requested by Ido. No new build or runtime test was run; both changes only delete the stale comment and WARN_ON().

---
v2:
- Add the IPv6 counterpart.

v1: <[email protected]>

Daehyeon Ko (2):
ipv4: do not warn on route notification size race
ipv6: do not warn on route notification size race

 net/ipv4/fib_trie.c | 2 --
 net/ipv6/route.c    | 2 --
 2 files changed, 4 deletions(-)

base-commit: 23609bce9e1de525d1d0e73fc68c6e7971d0b49e

Signature · 1 line
2.55.0
#1 lore raw

PATCH v2 1/2 ipv4: do not warn on route notification size race

Commit 680aea08e78c ("net: ipv4: Emit notification when fib hardware flags are changed") added asynchronous route notifications for hardware flag changes.

fib_alias_hw_flags_set() sizes the skb with fib_nlmsg_size() and later fills it with fib_dump_info() while holding only RCU. With nexthop compatibility mode enabled, a concurrent replacement can grow the group between these independent snapshots. fib_dump_info() can then legitimately return -EMSGSIZE, so the warning does not prove a sizing bug.

Remove the warning. The existing error path still frees the skb and reports the error to listeners.

Fixes 680aea08e78c ("net: ipv4: Emit notification when fib hardware flags are changed")
Assisted-by LLM
---
 net/ipv4/fib_trie.c | 2 --
 1 file changed, 2 deletions(-)
net/ipv4/fib_trie.c +0 -2
index acb1e43859143e..248514dce0cdd5 100644
@@ -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;
 	}
Signature · 1 line
2.55.0
#2 lore raw

PATCH v2 2/2 ipv6: do not warn on route notification size race

In reply to Daehyeon Ko

fib6_info_hw_flags_set() sizes the skb with rt6_nlmsg_size() and later fills it with rt6_fill_node(). With nexthop compatibility mode enabled, a concurrent replacement can grow the group between these independent snapshots. rt6_fill_node() can then legitimately return -EMSGSIZE, so the warning does not prove a sizing bug.

Remove the warning. The existing error path still frees the skb and reports the error to listeners.

Fixes 907eea486888 ("net: ipv6: Emit notification when fib hardware flags are changed")
Assisted-by LLM
---
 net/ipv6/route.c | 2 --
 1 file changed, 2 deletions(-)
net/ipv6/route.c +0 -2
index 153ce16628c1e1..a5e955e56e794f 100644
@@ -6509,8 +6509,6 @@ void fib6_info_hw_flags_set(struct net *net, struct fib6_info *f6i,
 	err = rt6_fill_node(net, skb, f6i, NULL, NULL, NULL, 0, RTM_NEWROUTE, 0,
 			    0, 0, RT_DEL_REASON_UNSPEC);
 	if (err < 0) {
-		/* -EMSGSIZE implies BUG in rt6_nlmsg_size() */
-		WARN_ON(err == -EMSGSIZE);
 		kfree_skb(skb);
 		goto errout;
 	}
Signature · 1 line
2.55.0
#3 lore raw
In reply to Daehyeon Ko
This is an automated message. This series looks like a fix, but its commit messages seem to be missing some information:

Hi!

This is an automated message. This series looks like a fix, but its commit messages seem to be missing some information:

- Whether the issue was actually triggered, or is only theoretical (e.g. found by code inspection). If it was triggered please include the symptoms, like the stack trace or error messages.

Please do not repost the series just to address the above. Instead, reply to this email with the missing information, so that reviewers can take it into account. If the series needs another revision for other reasons, please include the information in the commit messages then.

The evaluation is done by an LLM so it may be wrong, if you think that is the case please reply and explain.

#4 lore raw
In reply to Daehyeon Ko
This series was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This series was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:

Quoted 9 lines · On Thu, 8 Oct 2026 14:29:21 +0900 you wrote:

A nexthop group can grow between route notification sizing and filling. Both IPv4 and IPv6 can then legitimately return -EMSGSIZE, so remove the stale warnings while preserving their existing error paths.

Patch 1 is unchanged from v1. Patch 2 adds the IPv6 counterpart requested by Ido. No new build or runtime test was run; both changes only delete the stale comment and WARN_ON().

[...]

Here is the summary with links:
- [net,v2,1/2] ipv4: do not warn on route notification size race

    https://git.kernel.org/netdev/net/c/e02a5b658816
  - [net,v2,2/2] ipv6: do not warn on route notification size race
    https://git.kernel.org/netdev/net/c/c97426ec649d

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html