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 7DD7D32BF21; Fri, 9 Jan 2026 11:59:44 +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=1767959984; cv=none; b=Ph2JgR93t5Zn9T6Mx9zPd89W/JZsUEvFpWbVXRtRRaZiBfjxWQwBZa649Zpo6GpI5K1GixAQCtmUAAmafExOubC99YzrYJL1k9tMdZ6pDN742e099LuT8E+yma43rgF9UHbXGUBxjxGPRnVa0lwwYAt3K3/9qWLa5nr4dzoD0/0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767959984; c=relaxed/simple; bh=w/6C8GgCtcfbz0gg0bVcHsvFRxsf2k8Eh2DZHhBUbfg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=mHf7tN8mSx7+SWJT7Y5azbYp89MFpgwQlKOhIySEIcD/Wip+/ajk+5/Xr5MQpVPoAUx3IkrA/q/hzptm3RtG6Mc7ze01VLY8lwMrPWRT6FxS4G9cG75dmEcUn5TtN/OkKjBeq3qtcF3VfIcQVrDUi3iNg4VpIDxKd4R84ylnSkg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=n97c/Ppt; 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="n97c/Ppt" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 080A0C16AAE; Fri, 9 Jan 2026 11:59:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1767959984; bh=w/6C8GgCtcfbz0gg0bVcHsvFRxsf2k8Eh2DZHhBUbfg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=n97c/PptQqTYc1ALSEMmwOHWr4eoQ2HCktbcW3ju17IMzOXH91jeWfskyz8xFbnk4 qxXPJ4IVP+BNea1n+/LJ3ttCVKdKjvEUr+IUai1psuWvrCKNZrSkfbNGQ6bk5bociE V9YvH0DikfCond/A7cc3S+2wKDLSA3K79JvrK+K4= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Alexey Kodanev , "Russell King (Oracle)" , Jakub Kicinski , Sasha Levin Subject: [PATCH 6.6 243/737] net: stmmac: fix rx limit check in stmmac_rx_zc() Date: Fri, 9 Jan 2026 12:36:22 +0100 Message-ID: <20260109112143.137663404@linuxfoundation.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260109112133.973195406@linuxfoundation.org> References: <20260109112133.973195406@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Alexey Kodanev [ Upstream commit 8048168df56e225c94e50b04cb7b0514135d7a1c ] The extra "count >= limit" check in stmmac_rx_zc() is redundant and has no effect because the value of "count" doesn't change after the while condition at this point. However, it can change after "read_again:" label: while (count < limit) { ... if (count >= limit) break; read_again: ... /* XSK pool expects RX frame 1:1 mapped to XSK buffer */ if (likely(status & rx_not_ls)) { xsk_buff_free(buf->xdp); buf->xdp = NULL; dirty++; count++; goto read_again; } ... This patch addresses the same issue previously resolved in stmmac_rx() by commit fa02de9e7588 ("net: stmmac: fix rx budget limit check"). The fix is the same: move the check after the label to ensure that it bounds the goto loop. Fixes: bba2556efad6 ("net: stmmac: Enable RX via AF_XDP zero-copy") Signed-off-by: Alexey Kodanev Reviewed-by: Russell King (Oracle) Link: https://patch.msgid.link/20251126104327.175590-1-aleksei.kodanev@bell-sw.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 56a61599d0b6f..255c959886752 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -5141,10 +5141,10 @@ static int stmmac_rx_zc(struct stmmac_priv *priv, int limit, u32 queue) len = 0; } +read_again: if (count >= limit) break; -read_again: buf1_len = 0; entry = next_entry; buf = &rx_q->buf_pool[entry]; -- 2.51.0