lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240701195507.256374-6-tom@herbertland.com>
Date: Mon,  1 Jul 2024 12:55:05 -0700
From: Tom Herbert <tom@...bertland.com>
To: davem@...emloft.net,
	kuba@...nel.org,
	jesse.brandeburg@...el.com,
	anthony.l.nguyen@...el.com,
	cai.huoqing@...ux.dev,
	netdev@...r.kernel.org,
	felipe@...anda.io,
	justin.iurman@...ege.be
Cc: Tom Herbert <tom@...bertland.com>
Subject: [PATCH net-next v2 5/7] idpf: Don't do TX csum offload with routing header present

When determining if the L4 checksum in an IPv6 packet can be offloaded
on transmit, call ipv6_skip_exthdr_no_rthdr to check for the presence
of a routing header. If a routing header is present, that is the
function return less than zero, then don't offload checksum and call
skb_checksum_help instead.

Signed-off-by: Tom Herbert <tom@...bertland.com>
---
 .../ethernet/intel/idpf/idpf_singleq_txrx.c   | 28 +++++++++----------
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/drivers/net/ethernet/intel/idpf/idpf_singleq_txrx.c b/drivers/net/ethernet/intel/idpf/idpf_singleq_txrx.c
index 27b93592c4ba..3b0bc4d7d691 100644
--- a/drivers/net/ethernet/intel/idpf/idpf_singleq_txrx.c
+++ b/drivers/net/ethernet/intel/idpf/idpf_singleq_txrx.c
@@ -57,10 +57,12 @@ static int idpf_tx_singleq_csum(struct sk_buff *skb,
 			tunnel |= IDPF_TX_CTX_EXT_IP_IPV6;
 
 			l4_proto = ip.v6->nexthdr;
-			if (ipv6_ext_hdr(l4_proto))
-				ipv6_skip_exthdr(skb, skb_network_offset(skb) +
-						 sizeof(*ip.v6),
-						 &l4_proto, &frag_off);
+			if (ipv6_ext_hdr(l4_proto) &&
+			    ipv6_skip_exthdr_no_rthdr(skb,
+						      skb_network_offset(skb) +
+						      sizeof(*ip.v6), &l4_proto,
+						      &frag_off) < 0)
+				goto no_csum_offload;
 		}
 
 		/* define outer transport */
@@ -76,6 +78,7 @@ static int idpf_tx_singleq_csum(struct sk_buff *skb,
 			l4.hdr = skb_inner_network_header(skb);
 			break;
 		default:
+no_csum_offload:
 			if (is_tso)
 				return -1;
 
@@ -131,10 +134,12 @@ static int idpf_tx_singleq_csum(struct sk_buff *skb,
 	} else if (off->tx_flags & IDPF_TX_FLAGS_IPV6) {
 		cmd |= IDPF_TX_DESC_CMD_IIPT_IPV6;
 		l4_proto = ip.v6->nexthdr;
-		if (ipv6_ext_hdr(l4_proto))
-			ipv6_skip_exthdr(skb, skb_network_offset(skb) +
-					 sizeof(*ip.v6), &l4_proto,
-					 &frag_off);
+		if (ipv6_ext_hdr(l4_proto) &&
+		    ipv6_skip_exthdr_no_rthdr(skb,
+					      skb_network_offset(skb) +
+					      sizeof(*ip.v6), &l4_proto,
+					      &frag_off) < 0)
+			goto no_csum_offload;
 	} else {
 		return -1;
 	}
@@ -161,12 +166,7 @@ static int idpf_tx_singleq_csum(struct sk_buff *skb,
 		l4_len = sizeof(struct sctphdr) >> 2;
 		break;
 	default:
-		if (is_tso)
-			return -1;
-
-		skb_checksum_help(skb);
-
-		return 0;
+		goto no_csum_offload;
 	}
 
 	offset |= l4_len << IDPF_TX_DESC_LEN_L4_LEN_S;
-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ