From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 1249D2D97A4; Tue, 11 Nov 2025 01:13:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762823604; cv=none; b=ng9gf1nKzeOMDlEO+76kRx2YKZIdtktn33yv0yWnUgPB5oto9s8QIN0KwcnozGMEm9/04d3gPRWrsEfeHt5Fn5vXmjJ0oAudQThieoXdkfsfmEExvrYTenslH4h5zkVY4qX217rC728uFrTEWNagrJgtHEC+l2PENbO6H9vRO2o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762823604; c=relaxed/simple; bh=/102WdBlA5sSpX/1QhcYBKHN6ONksyGKA7N4FetiH+I=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=DhxS7WPLO3QUHLkMHZdsmQjzeBzeHH9wbk1R9LLeCwiI59xszRwXvCJ1qWQszbOddOdI6KUh89PVZwMfTuIwH59VcTTlGGE9hKBZm/aD6KY0KTx8UHllJgcM3VSWgbPYcDdt276eLW/3aA05W0QFwSTL59m0MZB0h5/lLpC8fB4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=xawcXPWU; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="xawcXPWU" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A6E4AC4CEFB; Tue, 11 Nov 2025 01:13:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1762823603; bh=/102WdBlA5sSpX/1QhcYBKHN6ONksyGKA7N4FetiH+I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xawcXPWUBALVQGsvkuasLvTC6pIjshfMa34g3pYoseNMP8YhA60WMdHf/2ML2a3w3 xGg2T2weztMktYZ08dPVf4ojE27SYqqrYOJ7P1JZfYiUarueBVVw+G+RoCdezgjx0m OxZ56Qem3qPnFDJN0+AHRtUVo27HyNsLYMEKY1CY= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Oleksij Rempel , Jakub Kicinski , Sasha Levin Subject: [PATCH 6.17 334/849] net: stmmac: Correctly handle Rx checksum offload errors Date: Tue, 11 Nov 2025 09:38:24 +0900 Message-ID: <20251111004544.491264962@linuxfoundation.org> X-Mailer: git-send-email 2.51.2 In-Reply-To: <20251111004536.460310036@linuxfoundation.org> References: <20251111004536.460310036@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.17-stable review patch. If anyone has any objections, please let me know. ------------------ From: Oleksij Rempel [ Upstream commit ee0aace5f844ef59335148875d05bec8764e71e8 ] 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 Link: https://patch.msgid.link/20250818090217.2789521-2-o.rempel@pengutronix.de Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- 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/net/ethernet/stmicro/stmmac/stmmac_main.c index b9f55e4e360fb..7a375de2258c4 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -5735,7 +5735,8 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue) skb->protocol = eth_type_trans(skb, priv->dev); - 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 = CHECKSUM_UNNECESSARY; -- 2.51.0