Skip to contentSkip to conversation

ipv4: route: fix drop reason being overridden in ip_route_input_slow

PATCH Applied Antoine Tenart 3 participants 3 messages Jan 8, 2025 – Jan 10, 2025

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

PATCH 1/1 ipv4: route: fix drop reason being overridden in ip_route_input_slow

When jumping to 'martian_destination' a drop reason is always set but that label falls-through the 'e_nobufs' one, overriding the value.

The behavior was introduced by the mentioned commit. The logic went from,

	goto martian_destination;
	...
  martian_destination:
	...
  e_inval:
	err = -EINVAL;
	goto out;
  e_nobufs:
	err = -ENOBUFS;
	goto out;

to,

	reason = ...;
	goto martian_destination;
	...
  martian_destination:
	...
  e_nobufs:
	reason = SKB_DROP_REASON_NOMEM;
	goto out;

A 'goto out' is clearly missing now after 'martian_destination' to avoid overriding the drop reason.

Fixes 5b92112acd8e ("net: ip: make ip_route_input_slow() return drop reasons")
Cc Menglong Dong <[email protected]>
---
 net/ipv4/route.c | 1 +
 1 file changed, 1 insertion(+)
net/ipv4/route.c +1 -0
index 0fbec3509618..e1564b95fab0 100644
@@ -2445,6 +2445,7 @@ ip_route_input_slow(struct sk_buff *skb, __be32 daddr, __be32 saddr,
 		net_warn_ratelimited("martian destination %pI4 from %pI4, dev %s\n",
 				     &daddr, &saddr, dev->name);
 #endif
+	goto out;
 
 e_nobufs:
 	reason = SKB_DROP_REASON_NOMEM;
Signature · 1 line
2.47.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 2 lines · Antoine Tenart

When jumping to 'martian_destination' a drop reason is always set but that label falls-through the 'e_nobufs' one, overriding the value.

[...]

Quoted 10 lines

A 'goto out' is clearly missing now after 'martian_destination' to avoid overriding the drop reason.

Fixes 5b92112acd8e ("net: ip: make ip_route_input_slow() return drop reasons")
Cc Menglong Dong <[email protected]>
---
 net/ipv4/route.c | 1 +
 1 file changed, 1 insertion(+)

Thanks Antoine.

Signature · 1 line
Sabrina
#2 lore raw
In reply to Antoine Tenart
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 17 lines · On Wed, 8 Jan 2025 17:57:15 +0100 you wrote:

When jumping to 'martian_destination' a drop reason is always set but that label falls-through the 'e_nobufs' one, overriding the value.

The behavior was introduced by the mentioned commit. The logic went from,

	goto martian_destination;
	...
  martian_destination:
	...
  e_inval:
	err = -EINVAL;
	goto out;
  e_nobufs:
	err = -ENOBUFS;
	goto out;
Quoted 1 line

[...]

Here is the summary with links:
- [net] ipv4: route: fix drop reason being overridden in ip_route_input_slow

    https://git.kernel.org/netdev/net/c/8c7a6efc017e

You are awesome, thank you!

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