netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] idpf: fix checksums set in idpf_rx_rsc()
@ 2025-02-26 22:12 Eric Dumazet
  2025-02-27  5:16 ` Przemek Kitszel
  2025-02-27 15:40 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Eric Dumazet @ 2025-02-26 22:12 UTC (permalink / raw)
  To: David S . Miller, Jakub Kicinski, Paolo Abeni, Tony Nguyen,
	Przemek Kitszel, Andrew Lunn
  Cc: Simon Horman, netdev, eric.dumazet, Eric Dumazet, Alan Brady,
	Joshua Hay, Willem de Bruijn

idpf_rx_rsc() uses skb_transport_offset(skb) while the transport header
is not set yet.

This triggers the following warning for CONFIG_DEBUG_NET=y builds.

DEBUG_NET_WARN_ON_ONCE(!skb_transport_header_was_set(skb))

[   69.261620] WARNING: CPU: 7 PID: 0 at ./include/linux/skbuff.h:3020 idpf_vport_splitq_napi_poll (include/linux/skbuff.h:3020) idpf
[   69.261629] Modules linked in: vfat fat dummy bridge intel_uncore_frequency_tpmi intel_uncore_frequency_common intel_vsec_tpmi idpf intel_vsec cdc_ncm cdc_eem cdc_ether usbnet mii xhci_pci xhci_hcd ehci_pci ehci_hcd libeth
[   69.261644] CPU: 7 UID: 0 PID: 0 Comm: swapper/7 Tainted: G S      W          6.14.0-smp-DEV #1697
[   69.261648] Tainted: [S]=CPU_OUT_OF_SPEC, [W]=WARN
[   69.261650] RIP: 0010:idpf_vport_splitq_napi_poll (include/linux/skbuff.h:3020) idpf
[   69.261677] ? __warn (kernel/panic.c:242 kernel/panic.c:748)
[   69.261682] ? idpf_vport_splitq_napi_poll (include/linux/skbuff.h:3020) idpf
[   69.261687] ? report_bug (lib/bug.c:?)
[   69.261690] ? handle_bug (arch/x86/kernel/traps.c:285)
[   69.261694] ? exc_invalid_op (arch/x86/kernel/traps.c:309)
[   69.261697] ? asm_exc_invalid_op (arch/x86/include/asm/idtentry.h:621)
[   69.261700] ? __pfx_idpf_vport_splitq_napi_poll (drivers/net/ethernet/intel/idpf/idpf_txrx.c:4011) idpf
[   69.261704] ? idpf_vport_splitq_napi_poll (include/linux/skbuff.h:3020) idpf
[   69.261708] ? idpf_vport_splitq_napi_poll (drivers/net/ethernet/intel/idpf/idpf_txrx.c:3072) idpf
[   69.261712] __napi_poll (net/core/dev.c:7194)
[   69.261716] net_rx_action (net/core/dev.c:7265)
[   69.261718] ? __qdisc_run (net/sched/sch_generic.c:293)
[   69.261721] ? sched_clock (arch/x86/include/asm/preempt.h:84 arch/x86/kernel/tsc.c:288)
[   69.261726] handle_softirqs (kernel/softirq.c:561)

Fixes: 3a8845af66edb ("idpf: add RX splitq napi poll support")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Alan Brady <alan.brady@intel.com>
Cc: Joshua Hay <joshua.a.hay@intel.com>
Cc: Willem de Bruijn <willemb@google.com>
---
 drivers/net/ethernet/intel/idpf/idpf_txrx.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/intel/idpf/idpf_txrx.c b/drivers/net/ethernet/intel/idpf/idpf_txrx.c
index 9be6a6b59c4e1414f993de39698b00fffa7d2940..977741c4149805b13b3b77fdfb612c514e2530e6 100644
--- a/drivers/net/ethernet/intel/idpf/idpf_txrx.c
+++ b/drivers/net/ethernet/intel/idpf/idpf_txrx.c
@@ -3013,7 +3013,6 @@ static int idpf_rx_rsc(struct idpf_rx_queue *rxq, struct sk_buff *skb,
 	skb_shinfo(skb)->gso_size = rsc_seg_len;
 
 	skb_reset_network_header(skb);
-	len = skb->len - skb_transport_offset(skb);
 
 	if (ipv4) {
 		struct iphdr *ipv4h = ip_hdr(skb);
@@ -3022,6 +3021,7 @@ static int idpf_rx_rsc(struct idpf_rx_queue *rxq, struct sk_buff *skb,
 
 		/* Reset and set transport header offset in skb */
 		skb_set_transport_header(skb, sizeof(struct iphdr));
+		len = skb->len - skb_transport_offset(skb);
 
 		/* Compute the TCP pseudo header checksum*/
 		tcp_hdr(skb)->check =
@@ -3031,6 +3031,7 @@ static int idpf_rx_rsc(struct idpf_rx_queue *rxq, struct sk_buff *skb,
 
 		skb_shinfo(skb)->gso_type = SKB_GSO_TCPV6;
 		skb_set_transport_header(skb, sizeof(struct ipv6hdr));
+		len = skb->len - skb_transport_offset(skb);
 		tcp_hdr(skb)->check =
 			~tcp_v6_check(len, &ipv6h->saddr, &ipv6h->daddr, 0);
 	}
-- 
2.48.1.658.g4767266eb4-goog


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

* Re: [PATCH net] idpf: fix checksums set in idpf_rx_rsc()
  2025-02-26 22:12 [PATCH net] idpf: fix checksums set in idpf_rx_rsc() Eric Dumazet
@ 2025-02-27  5:16 ` Przemek Kitszel
  2025-02-27 15:40 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Przemek Kitszel @ 2025-02-27  5:16 UTC (permalink / raw)
  To: Eric Dumazet, Tony Nguyen
  Cc: David S . Miller, Jakub Kicinski, Paolo Abeni, Andrew Lunn,
	Simon Horman, netdev, eric.dumazet, Joshua Hay, Willem de Bruijn,
	intel-wired-lan@lists.osuosl.org

On 2/26/25 23:12, Eric Dumazet wrote:
> idpf_rx_rsc() uses skb_transport_offset(skb) while the transport header
> is not set yet.
> 
> This triggers the following warning for CONFIG_DEBUG_NET=y builds.
> 
> DEBUG_NET_WARN_ON_ONCE(!skb_transport_header_was_set(skb))
> 
> [   69.261620] WARNING: CPU: 7 PID: 0 at ./include/linux/skbuff.h:3020 idpf_vport_splitq_napi_poll (include/linux/skbuff.h:3020) idpf
> [   69.261629] Modules linked in: vfat fat dummy bridge intel_uncore_frequency_tpmi intel_uncore_frequency_common intel_vsec_tpmi idpf intel_vsec cdc_ncm cdc_eem cdc_ether usbnet mii xhci_pci xhci_hcd ehci_pci ehci_hcd libeth
> [   69.261644] CPU: 7 UID: 0 PID: 0 Comm: swapper/7 Tainted: G S      W          6.14.0-smp-DEV #1697
> [   69.261648] Tainted: [S]=CPU_OUT_OF_SPEC, [W]=WARN
> [   69.261650] RIP: 0010:idpf_vport_splitq_napi_poll (include/linux/skbuff.h:3020) idpf
> [   69.261677] ? __warn (kernel/panic.c:242 kernel/panic.c:748)
> [   69.261682] ? idpf_vport_splitq_napi_poll (include/linux/skbuff.h:3020) idpf
> [   69.261687] ? report_bug (lib/bug.c:?)
> [   69.261690] ? handle_bug (arch/x86/kernel/traps.c:285)
> [   69.261694] ? exc_invalid_op (arch/x86/kernel/traps.c:309)
> [   69.261697] ? asm_exc_invalid_op (arch/x86/include/asm/idtentry.h:621)
> [   69.261700] ? __pfx_idpf_vport_splitq_napi_poll (drivers/net/ethernet/intel/idpf/idpf_txrx.c:4011) idpf
> [   69.261704] ? idpf_vport_splitq_napi_poll (include/linux/skbuff.h:3020) idpf
> [   69.261708] ? idpf_vport_splitq_napi_poll (drivers/net/ethernet/intel/idpf/idpf_txrx.c:3072) idpf
> [   69.261712] __napi_poll (net/core/dev.c:7194)
> [   69.261716] net_rx_action (net/core/dev.c:7265)
> [   69.261718] ? __qdisc_run (net/sched/sch_generic.c:293)
> [   69.261721] ? sched_clock (arch/x86/include/asm/preempt.h:84 arch/x86/kernel/tsc.c:288)
> [   69.261726] handle_softirqs (kernel/softirq.c:561)
> 
> Fixes: 3a8845af66edb ("idpf: add RX splitq napi poll support")
> Signed-off-by: Eric Dumazet <edumazet@google.com>

thank you for the fix,
Acked-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>

> Cc: Alan Brady <alan.brady@intel.com>
> Cc: Joshua Hay <joshua.a.hay@intel.com>
> Cc: Willem de Bruijn <willemb@google.com>
> ---
>   drivers/net/ethernet/intel/idpf/idpf_txrx.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/intel/idpf/idpf_txrx.c b/drivers/net/ethernet/intel/idpf/idpf_txrx.c
> index 9be6a6b59c4e1414f993de39698b00fffa7d2940..977741c4149805b13b3b77fdfb612c514e2530e6 100644
> --- a/drivers/net/ethernet/intel/idpf/idpf_txrx.c
> +++ b/drivers/net/ethernet/intel/idpf/idpf_txrx.c
> @@ -3013,7 +3013,6 @@ static int idpf_rx_rsc(struct idpf_rx_queue *rxq, struct sk_buff *skb,
>   	skb_shinfo(skb)->gso_size = rsc_seg_len;
>   
>   	skb_reset_network_header(skb);
> -	len = skb->len - skb_transport_offset(skb);
>   
>   	if (ipv4) {
>   		struct iphdr *ipv4h = ip_hdr(skb);
> @@ -3022,6 +3021,7 @@ static int idpf_rx_rsc(struct idpf_rx_queue *rxq, struct sk_buff *skb,
>   
>   		/* Reset and set transport header offset in skb */
>   		skb_set_transport_header(skb, sizeof(struct iphdr));
> +		len = skb->len - skb_transport_offset(skb);
>   
>   		/* Compute the TCP pseudo header checksum*/
>   		tcp_hdr(skb)->check =
> @@ -3031,6 +3031,7 @@ static int idpf_rx_rsc(struct idpf_rx_queue *rxq, struct sk_buff *skb,
>   
>   		skb_shinfo(skb)->gso_type = SKB_GSO_TCPV6;
>   		skb_set_transport_header(skb, sizeof(struct ipv6hdr));
> +		len = skb->len - skb_transport_offset(skb);
>   		tcp_hdr(skb)->check =
>   			~tcp_v6_check(len, &ipv6h->saddr, &ipv6h->daddr, 0);
>   	}


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

* Re: [PATCH net] idpf: fix checksums set in idpf_rx_rsc()
  2025-02-26 22:12 [PATCH net] idpf: fix checksums set in idpf_rx_rsc() Eric Dumazet
  2025-02-27  5:16 ` Przemek Kitszel
@ 2025-02-27 15:40 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-02-27 15:40 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: davem, kuba, pabeni, anthony.l.nguyen, przemyslaw.kitszel,
	andrew+netdev, horms, netdev, eric.dumazet, alan.brady,
	joshua.a.hay, willemb

Hello:

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

On Wed, 26 Feb 2025 22:12:52 +0000 you wrote:
> idpf_rx_rsc() uses skb_transport_offset(skb) while the transport header
> is not set yet.
> 
> This triggers the following warning for CONFIG_DEBUG_NET=y builds.
> 
> DEBUG_NET_WARN_ON_ONCE(!skb_transport_header_was_set(skb))
> 
> [...]

Here is the summary with links:
  - [net] idpf: fix checksums set in idpf_rx_rsc()
    https://git.kernel.org/netdev/net/c/674fcb4f4a7e

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-02-27 15:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-26 22:12 [PATCH net] idpf: fix checksums set in idpf_rx_rsc() Eric Dumazet
2025-02-27  5:16 ` Przemek Kitszel
2025-02-27 15:40 ` 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).