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 58F5633B966; Tue, 16 Dec 2025 11:31:26 +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=1765884686; cv=none; b=TPnZRWPc+G8NdmDuwxcy7WzqvktbpAeROEwC+D1yB9ZMmTxolJOPHKahK4vKgFLZb29CoKeiClxQnXddxES72A4iLCAuiOd0wg6Z+AL0j+uc5Mp9T1/qxdwK0tk7Cnx4/cWaMOat+x1HHWM0zorGgW0SPcUIZpH+kIAaSsGH9Xg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765884686; c=relaxed/simple; bh=Dj6b/5lpHPzwjHLtXoWmMXqmfJsirs1G0iJw5EaR7bU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=A4tty9vJugj9i0vVFRMEzVaBAplaJ5zVmyIAGdQ0bxlL34eOEeyUUM2YDA5N/32K8HFEocyJ5kyKMtE+1/F0Su//DI3XwSS/xa8mDxMjPBj3GRw1SdScxhJuHH90nGWS2oqJ0oVHSzq6I4D7+ldUmZKv0Vp7bECJOdHutyQkDEE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=mAF+P5bQ; 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="mAF+P5bQ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id BD3FDC4CEF1; Tue, 16 Dec 2025 11:31:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1765884686; bh=Dj6b/5lpHPzwjHLtXoWmMXqmfJsirs1G0iJw5EaR7bU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mAF+P5bQ05DoIsoqVVJ38Rg+2PxdiDOWipoh3uCRVRInpFE9PlzKWdNnqbIzJb59f TmtI0uxFS8inOrow19rA8CCp/2WM4zpFh/XetaFWznaQuLVs3O51+Vf5LJ0AymzM3H AEsz3tPD87mot4Bc8pyW9eKXCNEnp4Cpk5YZVlSQ= 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.12 268/354] net: stmmac: fix rx limit check in stmmac_rx_zc() Date: Tue, 16 Dec 2025 12:13:55 +0100 Message-ID: <20251216111330.625335168@linuxfoundation.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20251216111320.896758933@linuxfoundation.org> References: <20251216111320.896758933@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.12-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 04bacb04770fa..ce35a6f126793 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -5268,10 +5268,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