Skip to content

Commit ee0aace

Browse files
oleremkuba-moo
authored andcommitted
net: stmmac: Correctly handle Rx checksum offload errors
The stmmac_rx function would previously set skb->ip_summed to CHECKSUM_UNNECESSARY if hardware checksum offload (CoE) was enabled and the packet was of a known IP ethertype. However, this logic failed to check if the hardware had actually reported a checksum error. The hardware status, indicating a header or payload checksum failure, was being ignored at this stage. This could cause corrupt packets to be passed up the network stack as valid. This patch corrects the logic by checking the `csum_none` status flag, which is set when the hardware reports a checksum error. If this flag is set, skb->ip_summed is now correctly set to CHECKSUM_NONE, ensuring the kernel's network stack will perform its own validation and properly handle the corrupt packet. Signed-off-by: Oleksij Rempel <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 8beead2 commit ee0aace

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/net/ethernet/stmicro/stmmac/stmmac_main.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5737,7 +5737,8 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue)
57375737

57385738
skb->protocol = eth_type_trans(skb, priv->dev);
57395739

5740-
if (unlikely(!coe) || !stmmac_has_ip_ethertype(skb))
5740+
if (unlikely(!coe) || !stmmac_has_ip_ethertype(skb) ||
5741+
(status & csum_none))
57415742
skb_checksum_none_assert(skb);
57425743
else
57435744
skb->ip_summed = CHECKSUM_UNNECESSARY;

0 commit comments

Comments
 (0)