From: sashiko-bot@kernel.org
To: "Til Kaiser" <mail@tk154.de>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH net v2 3/4] net: mvpp2: do not return retired RX buffers to BM
Date: Wed, 03 Jun 2026 16:55:19 +0000 [thread overview]
Message-ID: <20260603165519.CFB561F0089A@smtp.kernel.org> (raw)
In-Reply-To: <20260602164635.62517-4-mail@tk154.de>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Fixing the UAF introduces a permanent leak of hardware Buffer Manager (BM) pool slots on RX refill failure, leading to a permanent RX stall.
--
commit 0804789e54c7ef2fb92f8bc16ab030a2285b6149
Author: Til Kaiser <mail@tk154.de>
net: mvpp2: do not return retired RX buffers to BM
This patch splits the RX error handling path to avoid returning buffers
to the hardware Buffer Manager (BM) pool after they have been passed to
XDP or built into an skb.
> diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
> index 3372ed27cc8d6..397aa5ca4992c 100644
> --- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
> +++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
> @@ -3991,7 +3991,7 @@ static int mvpp2_rx(struct mvpp2_port *port, struct napi_struct *napi,
> err = mvpp2_rx_refill(port, bm_pool, pp, pool);
> if (err) {
> netdev_err(port->dev, "failed to refill BM pools\n");
> - goto err_drop_frame;
> + goto err_drop_frame_retired;
[Severity: High]
Does skipping the buffer return here cause a permanent hardware pool leak?
By jumping to err_drop_frame_retired, we no longer put a replacement buffer
into the hardware Buffer Manager (BM) pool. If mvpp2_rx_refill() repeatedly
fails under memory pressure, will this drain the BM pool slots to zero and
permanently stall packet reception?
To avoid returning an already-consumed buffer while keeping the BM pool
full, would it be safer to perform the buffer allocation and refill
before passing the original buffer to XDP?
[ ... ]
> @@ -4023,13 +4025,16 @@ static int mvpp2_rx(struct mvpp2_port *port, struct napi_struct *napi,
> err = mvpp2_rx_refill(port, bm_pool, pp, pool);
> if (err) {
> netdev_err(port->dev, "failed to refill BM pools\n");
> + if (!pp)
> + dma_unmap_single_attrs(dev->dev.parent, dma_addr,
> + bm_pool->buf_size,
> + DMA_FROM_DEVICE,
> + DMA_ATTR_SKIP_CPU_SYNC);
> dev_kfree_skb_any(skb);
> - goto err_drop_frame;
> + goto err_drop_frame_retired;
[Severity: High]
Does this path also permanently lose a hardware buffer slot?
Since the successfully built skb is freed and we jump to
err_drop_frame_retired, the hardware BM pool does not get replenished.
Could the refill be done before calling build_skb() so the original buffer
can be safely returned to the hardware pool if allocation fails?
[ ... ]
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260602164635.62517-1-mail@tk154.de?part=3
next prev parent reply other threads:[~2026-06-03 16:55 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-02 16:46 [PATCH net v2 0/4] net: mvpp2: fix XDP RX buffer handling Til Kaiser
2026-06-02 16:46 ` [PATCH net v2 1/4] net: mvpp2: sync RX data at the hardware packet offset Til Kaiser
2026-06-03 16:55 ` sashiko-bot
2026-06-02 16:46 ` [PATCH net v2 2/4] net: mvpp2: limit XDP frame size to the RX buffer Til Kaiser
2026-06-03 16:55 ` sashiko-bot
2026-06-02 16:46 ` [PATCH net v2 3/4] net: mvpp2: do not return retired RX buffers to BM Til Kaiser
2026-06-03 16:55 ` sashiko-bot [this message]
2026-06-04 15:45 ` Jakub Kicinski
2026-06-02 16:46 ` [PATCH net v2 4/4] net: mvpp2: build skb from XDP-adjusted data on XDP_PASS Til Kaiser
2026-06-03 16:55 ` sashiko-bot
2026-06-03 13:55 ` [PATCH net v2 0/4] net: mvpp2: fix XDP RX buffer handling Alexander Lobakin
2026-06-04 11:30 ` Marcin Wojtas
2026-06-05 12:13 ` [PATCH net v3 " Til Kaiser
2026-06-05 12:13 ` [PATCH net v3 1/4] net: mvpp2: sync RX data at the hardware packet offset Til Kaiser
2026-06-05 12:13 ` [PATCH net v3 2/4] net: mvpp2: limit XDP frame size to the RX buffer Til Kaiser
2026-06-05 12:13 ` [PATCH net v3 3/4] net: mvpp2: refill RX buffers before XDP or skb use Til Kaiser
2026-06-05 12:13 ` [PATCH net v3 4/4] net: mvpp2: build skb from XDP-adjusted data on XDP_PASS Til Kaiser
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260603165519.CFB561F0089A@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=mail@tk154.de \
--cc=sashiko-reviews@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.