netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] ipv4: route: fix drop reason being overridden in ip_route_input_slow
@ 2025-01-08 16:57 Antoine Tenart
  2025-01-09 22:29 ` Sabrina Dubroca
  2025-01-10  2:10 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Antoine Tenart @ 2025-01-08 16:57 UTC (permalink / raw)
  To: davem, kuba, pabeni, edumazet
  Cc: Antoine Tenart, netdev, Sabrina Dubroca, Menglong Dong

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")
Reported-by: Sabrina Dubroca <sd@queasysnail.net>
Cc: Menglong Dong <menglong8.dong@gmail.com>
Signed-off-by: Antoine Tenart <atenart@kernel.org>
---
 net/ipv4/route.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 0fbec3509618..e1564b95fab0 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -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;
-- 
2.47.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net] ipv4: route: fix drop reason being overridden in ip_route_input_slow
  2025-01-08 16:57 [PATCH net] ipv4: route: fix drop reason being overridden in ip_route_input_slow Antoine Tenart
@ 2025-01-09 22:29 ` Sabrina Dubroca
  2025-01-10  2:10 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Sabrina Dubroca @ 2025-01-09 22:29 UTC (permalink / raw)
  To: Antoine Tenart; +Cc: davem, kuba, pabeni, edumazet, netdev, Menglong Dong

2025-01-08, 17:57:15 +0100, Antoine Tenart wrote:
> When jumping to 'martian_destination' a drop reason is always set but
> that label falls-through the 'e_nobufs' one, overriding the value.
[...]
> 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")
> Reported-by: Sabrina Dubroca <sd@queasysnail.net>
> Cc: Menglong Dong <menglong8.dong@gmail.com>
> Signed-off-by: Antoine Tenart <atenart@kernel.org>
> ---
>  net/ipv4/route.c | 1 +
>  1 file changed, 1 insertion(+)

Reviewed-by: Sabrina Dubroca <sd@queasysnail.net>

Thanks Antoine.

-- 
Sabrina

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net] ipv4: route: fix drop reason being overridden in ip_route_input_slow
  2025-01-08 16:57 [PATCH net] ipv4: route: fix drop reason being overridden in ip_route_input_slow Antoine Tenart
  2025-01-09 22:29 ` Sabrina Dubroca
@ 2025-01-10  2:10 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-01-10  2:10 UTC (permalink / raw)
  To: Antoine Tenart; +Cc: davem, kuba, pabeni, edumazet, netdev, sd, menglong8.dong

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:

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;
> 
> [...]

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!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-01-10  2:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-08 16:57 [PATCH net] ipv4: route: fix drop reason being overridden in ip_route_input_slow Antoine Tenart
2025-01-09 22:29 ` Sabrina Dubroca
2025-01-10  2:10 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).