Skip to content

Commit 4cab761

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 0d8726a commit 4cab761

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
@@ -1815,15 +1815,15 @@ static struct enet_cb *bcmgenet_put_txcb(struct bcmgenet_priv *priv,
18151815
{
18161816
struct enet_cb *tx_cb_ptr;
18171817

1818-
tx_cb_ptr = ring->cbs;
1819-
tx_cb_ptr += ring->write_ptr - ring->cb_ptr;
1820-
18211818
/* Rewinding local write pointer */
18221819
if (ring->write_ptr == ring->cb_ptr)
18231820
ring->write_ptr = ring->end_ptr;
18241821
else
18251822
ring->write_ptr--;
18261823

1824+
tx_cb_ptr = ring->cbs;
1825+
tx_cb_ptr += ring->write_ptr - ring->cb_ptr;
1826+
18271827
return tx_cb_ptr;
18281828
}
18291829

0 commit comments

Comments
 (0)