netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] net: netpoll: Initialize UDP checksum field before checksumming
@ 2025-06-20 18:48 Breno Leitao
  2025-06-21 17:55 ` Simon Horman
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Breno Leitao @ 2025-06-20 18:48 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Simon Horman, Joe Damato
  Cc: netdev, linux-kernel, kernel-team, Breno Leitao

commit f1fce08e63fe ("netpoll: Eliminate redundant assignment") removed
the initialization of the UDP checksum, which was wrong and broke
netpoll IPv6 transmission due to bad checksumming.

udph->check needs to be set before calling csum_ipv6_magic().

Fixes: f1fce08e63fe ("netpoll: Eliminate redundant assignment")
Signed-off-by: Breno Leitao <leitao@debian.org>
---
 net/core/netpoll.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/core/netpoll.c b/net/core/netpoll.c
index 4ddb7490df4b8..6ad84d4a2b464 100644
--- a/net/core/netpoll.c
+++ b/net/core/netpoll.c
@@ -432,6 +432,7 @@ int netpoll_send_udp(struct netpoll *np, const char *msg, int len)
 	udph->dest = htons(np->remote_port);
 	udph->len = htons(udp_len);
 
+	udph->check = 0;
 	if (np->ipv6) {
 		udph->check = csum_ipv6_magic(&np->local_ip.in6,
 					      &np->remote_ip.in6,
@@ -460,7 +461,6 @@ int netpoll_send_udp(struct netpoll *np, const char *msg, int len)
 		skb_reset_mac_header(skb);
 		skb->protocol = eth->h_proto = htons(ETH_P_IPV6);
 	} else {
-		udph->check = 0;
 		udph->check = csum_tcpudp_magic(np->local_ip.ip,
 						np->remote_ip.ip,
 						udp_len, IPPROTO_UDP,

---
base-commit: 720d4a1714e78cfdc05d44352868601be9c3de94
change-id: 20250620-netpoll_fix-8c678facd8d9

Best regards,
--  
Breno Leitao <leitao@debian.org>


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

* Re: [PATCH net] net: netpoll: Initialize UDP checksum field before checksumming
  2025-06-20 18:48 [PATCH net] net: netpoll: Initialize UDP checksum field before checksumming Breno Leitao
@ 2025-06-21 17:55 ` Simon Horman
  2025-06-23 23:00 ` patchwork-bot+netdevbpf
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Simon Horman @ 2025-06-21 17:55 UTC (permalink / raw)
  To: Breno Leitao
  Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Joe Damato, netdev, linux-kernel, kernel-team

On Fri, Jun 20, 2025 at 11:48:55AM -0700, Breno Leitao wrote:
> commit f1fce08e63fe ("netpoll: Eliminate redundant assignment") removed
> the initialization of the UDP checksum, which was wrong and broke
> netpoll IPv6 transmission due to bad checksumming.
> 
> udph->check needs to be set before calling csum_ipv6_magic().
> 
> Fixes: f1fce08e63fe ("netpoll: Eliminate redundant assignment")
> Signed-off-by: Breno Leitao <leitao@debian.org>

Reviewed-by: Simon Horman <horms@kernel.org>


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

* Re: [PATCH net] net: netpoll: Initialize UDP checksum field before checksumming
  2025-06-20 18:48 [PATCH net] net: netpoll: Initialize UDP checksum field before checksumming Breno Leitao
  2025-06-21 17:55 ` Simon Horman
@ 2025-06-23 23:00 ` patchwork-bot+netdevbpf
  2025-06-26 16:59 ` Willem de Bruijn
  2025-06-26 17:01 ` Willem de Bruijn
  3 siblings, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-06-23 23:00 UTC (permalink / raw)
  To: Breno Leitao
  Cc: davem, edumazet, kuba, pabeni, horms, jdamato, netdev,
	linux-kernel, kernel-team

Hello:

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

On Fri, 20 Jun 2025 11:48:55 -0700 you wrote:
> commit f1fce08e63fe ("netpoll: Eliminate redundant assignment") removed
> the initialization of the UDP checksum, which was wrong and broke
> netpoll IPv6 transmission due to bad checksumming.
> 
> udph->check needs to be set before calling csum_ipv6_magic().
> 
> Fixes: f1fce08e63fe ("netpoll: Eliminate redundant assignment")
> Signed-off-by: Breno Leitao <leitao@debian.org>
> 
> [...]

Here is the summary with links:
  - [net] net: netpoll: Initialize UDP checksum field before checksumming
    https://git.kernel.org/netdev/net/c/f59902070269

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] 5+ messages in thread

* Re: [PATCH net] net: netpoll: Initialize UDP checksum field before checksumming
  2025-06-20 18:48 [PATCH net] net: netpoll: Initialize UDP checksum field before checksumming Breno Leitao
  2025-06-21 17:55 ` Simon Horman
  2025-06-23 23:00 ` patchwork-bot+netdevbpf
@ 2025-06-26 16:59 ` Willem de Bruijn
  2025-06-26 17:01 ` Willem de Bruijn
  3 siblings, 0 replies; 5+ messages in thread
From: Willem de Bruijn @ 2025-06-26 16:59 UTC (permalink / raw)
  To: Breno Leitao, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Simon Horman, Joe Damato
  Cc: netdev, linux-kernel, kernel-team, Breno Leitao

Breno Leitao wrote:
> commit f1fce08e63fe ("netpoll: Eliminate redundant assignment") removed
> the initialization of the UDP checksum, which was wrong and broke
> netpoll IPv6 transmission due to bad checksumming.
> 
> udph->check needs to be set before calling csum_ipv6_magic().
> 
> Fixes: f1fce08e63fe ("netpoll: Eliminate redundant assignment")
> Signed-off-by: Breno Leitao <leitao@debian.org>

Reviewed-by: Willem de Bruijn <willemb@google.com>

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

* Re: [PATCH net] net: netpoll: Initialize UDP checksum field before checksumming
  2025-06-20 18:48 [PATCH net] net: netpoll: Initialize UDP checksum field before checksumming Breno Leitao
                   ` (2 preceding siblings ...)
  2025-06-26 16:59 ` Willem de Bruijn
@ 2025-06-26 17:01 ` Willem de Bruijn
  3 siblings, 0 replies; 5+ messages in thread
From: Willem de Bruijn @ 2025-06-26 17:01 UTC (permalink / raw)
  To: Breno Leitao, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Simon Horman, Joe Damato
  Cc: netdev, linux-kernel, kernel-team, Breno Leitao

Breno Leitao wrote:
> commit f1fce08e63fe ("netpoll: Eliminate redundant assignment") removed
> the initialization of the UDP checksum, which was wrong and broke
> netpoll IPv6 transmission due to bad checksumming.
> 
> udph->check needs to be set before calling csum_ipv6_magic().
> 
> Fixes: f1fce08e63fe ("netpoll: Eliminate redundant assignment")
> Signed-off-by: Breno Leitao <leitao@debian.org>

On second thought: small nit: net/core/netpoll.c patches generally
only have netpoll: as prefix, not net: netpoll:

Also, perhaps just revert the offending patch? Revert, rather than
forward fix.

That said, current approach works too.
> ---
>  net/core/netpoll.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/core/netpoll.c b/net/core/netpoll.c
> index 4ddb7490df4b8..6ad84d4a2b464 100644
> --- a/net/core/netpoll.c
> +++ b/net/core/netpoll.c
> @@ -432,6 +432,7 @@ int netpoll_send_udp(struct netpoll *np, const char *msg, int len)
>  	udph->dest = htons(np->remote_port);
>  	udph->len = htons(udp_len);
>  
> +	udph->check = 0;
>  	if (np->ipv6) {
>  		udph->check = csum_ipv6_magic(&np->local_ip.in6,
>  					      &np->remote_ip.in6,
> @@ -460,7 +461,6 @@ int netpoll_send_udp(struct netpoll *np, const char *msg, int len)
>  		skb_reset_mac_header(skb);
>  		skb->protocol = eth->h_proto = htons(ETH_P_IPV6);
>  	} else {
> -		udph->check = 0;
>  		udph->check = csum_tcpudp_magic(np->local_ip.ip,
>  						np->remote_ip.ip,
>  						udp_len, IPPROTO_UDP,
> 
> ---
> base-commit: 720d4a1714e78cfdc05d44352868601be9c3de94
> change-id: 20250620-netpoll_fix-8c678facd8d9
> 
> Best regards,
> --  
> Breno Leitao <leitao@debian.org>
> 



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

end of thread, other threads:[~2025-06-26 17:01 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-20 18:48 [PATCH net] net: netpoll: Initialize UDP checksum field before checksumming Breno Leitao
2025-06-21 17:55 ` Simon Horman
2025-06-23 23:00 ` patchwork-bot+netdevbpf
2025-06-26 16:59 ` Willem de Bruijn
2025-06-26 17:01 ` Willem de Bruijn

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).