[PATCH net 1/2] hinic3: Fix skb_checksum_help() failure handling in Tx path

Fan Gong <[email protected]> Mon, 3 Aug 2026 11:48:24 +0800
Newsgroups org.kernel.vger.linux-doc,org.kernel.vger.linux-kernel,org.kernel.vger.netdev
Message-ID <16ed10bb3470f17fe78b0803a8a550c2c720f3e6.1785727595.git.tengpeisen@huawei.com>
From: Teng Peisen <[email protected]>

From: Fan Gong <[email protected]>

hinic3_tx_csum() falls back to skb_checksum_help() for unsupported VXLAN
packets, but ignores its return value. On failure, this can cause packets
with uncalculated or corrupted checksums to be transmitted.

Fix this by returning the error status of skb_checksum_help() and marking
the offload as HINIC3_TX_OFFLOAD_INVALID in hinic3_tx_offload() so that the
packet is properly dropped.

Fixes: 17fcb3dc12bb ("hinic3: module initialization and tx/rx logic")
Co-developed-by: Teng Peisen <[email protected]>
Signed-off-by: Teng Peisen <[email protected]>
Signed-off-by: Fan Gong <[email protected]>
---
 drivers/net/ethernet/huawei/hinic3/hinic3_tx.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/huawei/hinic3/hinic3_tx.c b/drivers/net/ethernet/huawei/hinic3/hinic3_tx.c
index 9306bf0020ca..53c065194136 100644
--- a/drivers/net/ethernet/huawei/hinic3/hinic3_tx.c
+++ b/drivers/net/ethernet/huawei/hinic3/hinic3_tx.c
@@ -261,8 +261,7 @@ static int hinic3_tx_csum(struct hinic3_txq *txq, struct hinic3_sq_task *task,
 		    ((struct udphdr *)skb_transport_header(skb))->dest !=
 		    VXLAN_OFFLOAD_PORT_LE) {
 			/* Unsupported tunnel packet, disable csum offload */
-			skb_checksum_help(skb);
-			return 0;
+			return skb_checksum_help(skb);
 		}
 	}
 
@@ -412,6 +411,10 @@ static u32 hinic3_tx_offload(struct sk_buff *skb, struct hinic3_sq_task *task,
 		offload |= HINIC3_TX_OFFLOAD_TSO;
 	} else {
 		tso_cs_en = hinic3_tx_csum(txq, task, skb);
+		if (tso_cs_en < 0) {
+			offload = HINIC3_TX_OFFLOAD_INVALID;
+			return offload;
+		}
 		if (tso_cs_en)
 			offload |= HINIC3_TX_OFFLOAD_CSUM;
 	}

base-commit: 2195424c3da2ef1829a63b807e3a900a90e57d85
-- 
2.54.0