]> exis.tech > repos - linux.git/commit
net: mvpp2: refill RX buffers before XDP or skb use
authorTil Kaiser <mail@tk154.de>
Sun, 7 Jun 2026 13:49:42 +0000 (15:49 +0200)
committerPaolo Abeni <pabeni@redhat.com>
Thu, 11 Jun 2026 07:57:31 +0000 (09:57 +0200)
commit5e8e2a9624df72fca7c736b2966b2cbf6c9c3ff6
treeadb0381ccb32e0e21023ba87db46fa17078dfb79
parentf3c6aa078927e6fe8121c9c591ddee8716c5305a
net: mvpp2: refill RX buffers before XDP or skb use

The RX error path returns the current descriptor buffer to the hardware
BM pool. That is only valid while the driver still owns the buffer.

mvpp2_rx_refill() can fail after the current buffer has been handed to
XDP or attached to an skb. In those cases mvpp2_run_xdp() may have
recycled, redirected, or queued the page for XDP_TX, and an skb free also
retires the data buffer. Returning such a buffer to BM lets hardware DMA
into memory that is no longer owned by the RX ring.

Refill the BM pool before handing the current buffer to XDP or to the
skb. If the allocation fails there, drop the packet and return the
still-owned current buffer to BM, preserving the pool depth. Once the
refill succeeds, later local drops retire/free the current buffer instead
of returning it to BM.

Fixes: 07dd0a7aae7f ("mvpp2: add basic XDP support")
Fixes: d6526926de73 ("net: mvpp2: fix memory leak in mvpp2_rx")
Signed-off-by: Til Kaiser <mail@tk154.de>
Link: https://patch.msgid.link/20260607134943.21996-4-mail@tk154.de
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c