ipv4: use WARN_ON_ONCE() in ip_rt_bug()
Subsystems (3)
PATCH 1/1 ipv4: use WARN_ON_ONCE() in ip_rt_bug()
It turns out ip_rt_bug() can be called more than expected.
syzbot will still panic (because of panic_on_warn=1), but non debug kernels will no longer die while repeating stack traces on the console.
--- net/ipv4/route.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv4/route.c +1 -1
@@ -1272,7 +1272,7 @@ static int ip_rt_bug(struct net *net, struct sock *sk, struct sk_buff *skb) __func__, &ip_hdr (skb)->saddr, &ip_hdr (skb)->daddr, skb->dev ? skb->dev->name : "?");kfree_skb (skb); -WARN_ON (1 ); +WARN_ON_ONCE (1 );return 0 ; }
Signature · 1 line
2.54.0.631.ge1b05301d1-goog
Quoted 11 lines · Eric Dumazet
It turns out
ip_rt_bug()can be called more than expected.syzbot will still panic (because of panic_on_warn=1), but non debug kernels will no longer die while repeating stack traces on the console.
Fixes c378a9c019cf ("ipv4: Give backtrace in ip_rt_bug().")Signed-off-by Eric Dumazet <[email protected]>--- net/ipv4/route.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 16 lines · Eric Dumazet
It turns out
ip_rt_bug()can be called more than expected.syzbot will still panic (because of panic_on_warn=1), but non debug kernels will no longer die while repeating stack traces on the console.
Fixes c378a9c019cf ("ipv4: Give backtrace in ip_rt_bug().")Signed-off-by Eric Dumazet <[email protected]>--- net/ipv4/route.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)net/ipv4/route.c +0
-0
net/ipv4/route.c static int ip_rt_bug(struct net *net, struct sock *sk, struct sk_buff *skb) · line 1278
Quoted 8 lines
net/ipv4/route.c +1
-1@@ -1272,7 +1272,7 @@ static int ip_rt_bug(struct net *net, struct sock *sk, struct sk_buff *skb) __func__, &ip_hdr (skb)->saddr, &ip_hdr (skb)->daddr, skb->dev ? skb->dev->name : "?");kfree_skb (skb); -WARN_ON (1 ); +WARN_ON_ONCE (1 );return 0 ; }
Recently I backported one missing patch to stable because of excessive ip_rt_bug() prints. So I think it is reasonable to carry a Fixes tag for backporting.
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:
Quoted 9 lines · On Tue, 19 May 2026 19:32:48 +0000 you wrote:
It turns out
ip_rt_bug()can be called more than expected.syzbot will still panic (because of panic_on_warn=1), but non debug kernels will no longer die while repeating stack traces on the console.
Fixes c378a9c019cf ("ipv4: Give backtrace in ip_rt_bug().")Signed-off-by Eric Dumazet <[email protected]>[...]
Here is the summary with links:
- [net] ipv4: use WARN_ON_ONCE() in ip_rt_bug()
https://git.kernel.org/netdev/net/c/e4bdef4d320b
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html