From nobody Sat Oct 4 11:11:53 2025 Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 538DB304BB5 for ; Mon, 18 Aug 2025 09:02:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.203.201.7 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755507758; cv=none; b=AfZlEV7PRd0SpkbnjyQ/4EcP8pvXYbbpCpwB1T9roHMY+MSCB7BGSo9Mfx0Bq5t8uoNYayTklkHHpGqZtQ38rkdzIO5hjcd3X6K+GbOhgzgSkPbVbC8lSSlrmoZTnj3B9W8GhpFlTLWUpjLzEnp63HMBZ3IHUH48EAl++FJU6Y4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755507758; c=relaxed/simple; bh=qALKcs2I9DsQXdi+amMeBicjXd8u1yrHnBOjvx/vG9g=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=iaL8InsrfqamJKM3hloM2NY+LBS3Z6y5RTt24M85fPt9kgi60gHrJuo1LmTKxOVAB07jTLD9CNnZc/URBnxFhttoOpqwnac4yLaWdhsx0Uq9EJo3saJRk9yH9H4Jcc2e5M1+NWrS93DrOMjkF9L/U01ZnDSy8Ec4Dhj+Ry0bT1Q= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; arc=none smtp.client-ip=185.203.201.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1unvky-0003N3-Rd; Mon, 18 Aug 2025 11:02:20 +0200 Received: from dude04.red.stw.pengutronix.de ([2a0a:edc0:0:1101:1d::ac]) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1unvkw-000sBC-2J; Mon, 18 Aug 2025 11:02:18 +0200 Received: from ore by dude04.red.stw.pengutronix.de with local (Exim 4.96) (envelope-from ) id 1unvkw-00Bhgp-24; Mon, 18 Aug 2025 11:02:18 +0200 From: Oleksij Rempel To: Andrew Lunn , Alexandre Torgue , Jose Abreu , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin Cc: Oleksij Rempel , kernel@pengutronix.de, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Simon Horman , "Russell King (Oracle)" , =?UTF-8?q?S=C3=B8ren=20Andersen?= Subject: [PATCH net-next v1 1/3] net: stmmac: Correctly handle Rx checksum offload errors Date: Mon, 18 Aug 2025 11:02:15 +0200 Message-Id: <20250818090217.2789521-2-o.rempel@pengutronix.de> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250818090217.2789521-1-o.rempel@pengutronix.de> References: <20250818090217.2789521-1-o.rempel@pengutronix.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: ore@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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 --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/ne= t/ethernet/stmicro/stmmac/stmmac_main.c index 9a77390b7f9d..75d8d8042316 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -5733,7 +5733,8 @@ static int stmmac_rx(struct stmmac_priv *priv, int li= mit, u32 queue) =20 skb->protocol =3D eth_type_trans(skb, priv->dev); =20 - if (unlikely(!coe) || !stmmac_has_ip_ethertype(skb)) + if (unlikely(!coe) || !stmmac_has_ip_ethertype(skb) || + (status & csum_none)) skb_checksum_none_assert(skb); else skb->ip_summed =3D CHECKSUM_UNNECESSARY; --=20 2.39.5