From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 651363F787E; Wed, 20 May 2026 18:02:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779300175; cv=none; b=INOgZwqZSQgge7AyKjucq0YeDKPwyLbXuCI+Bipqe/1qOHBNrqD05sS9EJgU5xE7452Iwm1KKLybE/CL2b1HkN6y/CStQK2G+JsbZb5ulVcYAYCDQk9sKKAnSVdZ53qWFqRZS0taScobJnMD/mFhzw48HebXqtERhL9WOx9+AEo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779300175; c=relaxed/simple; bh=nclZ9JiycfGznSDjMZyVKsNUjlOyOxqetqwISJGaQGU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=QjcnYSvKV2HwJwcEgIuPRdN8imb2uy3HskghTDgPxrB4d6FIe2EnBzbeHEcpzUlh2Wt1V1xQDnbIxzvG5uewLh0XVpFFokk6QNerG3y+hI5Hro4u9hkJgrrPUbqicriJlHNQDRhmJLmxWyVkVB2P5CbfE0PvBc6Cz8oBePQCkfY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=IdpBToOw; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="IdpBToOw" Received: by smtp.kernel.org (Postfix) with ESMTPSA id CC7361F000E9; Wed, 20 May 2026 18:02:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1779300174; bh=A3Fye46jNKNb67mx8874n1XOCCCgPNMkn4YWTJ9IM6Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=IdpBToOwQaUAlpbMKtXA8kgWqiB/qg9UFvSSNVp3Vt7SZf3bQuHbvD3C7YZ/eiFXy 5NFtxuJUg0/ZBY1UHw+FAyKI47DqgUrc4EzBORnIEj1xce36sw/PcQAmaEiakL+CJo I7ziSBsSu4Bpte3G4r71WeHhJcq56mUQfB6IK4fk= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Justin Chen , Nicolai Buchwitz , Jakub Kicinski , Sasha Levin Subject: [PATCH 6.12 073/666] net: bcmgenet: fix off-by-one in bcmgenet_put_txcb Date: Wed, 20 May 2026 18:14:44 +0200 Message-ID: <20260520162112.813898723@linuxfoundation.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260520162111.222830634@linuxfoundation.org> References: <20260520162111.222830634@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: Justin Chen [ Upstream commit 57f3f53d2c9c5a9e133596e2f7bc1c50688a6d38 ] The write_ptr points to the next open tx_cb. We want to return the tx_cb that gets rewinded, so we must rewind the pointer first then return the tx_cb that it points to. That way the txcb can be correctly cleaned up. Fixes: 876dbadd53a7 ("net: bcmgenet: Fix unmapping of fragments in bcmgenet_xmit()") Signed-off-by: Justin Chen Reviewed-by: Nicolai Buchwitz Link: https://patch.msgid.link/20260406175756.134567-2-justin.chen@broadcom.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- drivers/net/ethernet/broadcom/genet/bcmgenet.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c index 49f6e83d60139..ac9bd34f3b3ce 100644 --- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c +++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c @@ -1740,15 +1740,15 @@ static struct enet_cb *bcmgenet_put_txcb(struct bcmgenet_priv *priv, { struct enet_cb *tx_cb_ptr; - tx_cb_ptr = ring->cbs; - tx_cb_ptr += ring->write_ptr - ring->cb_ptr; - /* Rewinding local write pointer */ if (ring->write_ptr == ring->cb_ptr) ring->write_ptr = ring->end_ptr; else ring->write_ptr--; + tx_cb_ptr = ring->cbs; + tx_cb_ptr += ring->write_ptr - ring->cb_ptr; + return tx_cb_ptr; } -- 2.53.0