Skip to content

Commit 29394f7

Browse files
Ryceancurrygregkh
authored andcommitted
net: bcmgenet: fix off-by-one in bcmgenet_put_txcb
[ Upstream commit 57f3f53 ] 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: 876dbad ("net: bcmgenet: Fix unmapping of fragments in bcmgenet_xmit()") Signed-off-by: Justin Chen <justin.chen@broadcom.com> Reviewed-by: Nicolai Buchwitz <nb@tipi-net.de> Link: https://patch.msgid.link/20260406175756.134567-2-justin.chen@broadcom.com Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 0669a46 commit 29394f7

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

drivers/net/ethernet/broadcom/genet/bcmgenet.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1740,15 +1740,15 @@ static struct enet_cb *bcmgenet_put_txcb(struct bcmgenet_priv *priv,
17401740
{
17411741
struct enet_cb *tx_cb_ptr;
17421742

1743-
tx_cb_ptr = ring->cbs;
1744-
tx_cb_ptr += ring->write_ptr - ring->cb_ptr;
1745-
17461743
/* Rewinding local write pointer */
17471744
if (ring->write_ptr == ring->cb_ptr)
17481745
ring->write_ptr = ring->end_ptr;
17491746
else
17501747
ring->write_ptr--;
17511748

1749+
tx_cb_ptr = ring->cbs;
1750+
tx_cb_ptr += ring->write_ptr - ring->cb_ptr;
1751+
17521752
return tx_cb_ptr;
17531753
}
17541754

0 commit comments

Comments
 (0)