From: netdev-bot+sashiko@kernel.org
To: filzador@gmail.com
Cc: ronak.doshi@broadcom.com, bcm-kernel-feedback-list@broadcom.com,
netdev@vger.kernel.org, bpf@vger.kernel.org,
andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org,
kuba@kernel.org, pabeni@redhat.com, ast@kernel.org,
daniel@iogearbox.net, hawk@kernel.org, john.fastabend@gmail.com,
sdf@fomichev.me, u9012063@gmail.com
Subject: Re: [PATCH net v3 4/5] vmxnet3: drop XDP frames that do not fit in one rx buffer
Date: Sun, 29 Nov 2026 08:27:55 +0000 [thread overview]
Message-ID: <179594087560.3146.8294301865977150437@kernel.org> (raw)
In-Reply-To: <20261125075255.1517-5-filzador@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.
Critical: 0 · High: 0 (1) · Medium: 1 · Low: 0
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [Medium] Besides the XDP crash, this patch fixes a second, older crash
in the non-XDP rx path, but its only Fixes: tag points at the XDP…
Pre-existing issues:
- [High] This problem wasn't introduced by this patch, but it is a
serious one in the same XDP rx path.
--
vmxnet3: drop XDP frames that do not fit in one rx buffer
With XDP enabled, a frame that spans a head and a body descriptor used to
fall through to the skb path in vmxnet3_rq_rx_complete(). That path treated
the page_pool page in rbi->skb as an skb and crashed. This patch drops such
frames, starts each poll with skip_page_frags set when no frame is in
progress, and adds drop_total accounting to the body buffer allocation
failure paths.
> diff --git a/drivers/net/vmxnet3/vmxnet3_drv.c b/drivers/net/vmxnet3/vmxnet3_drv.c
> index e8be95c1d9f8e..234897abfe0ad 100644
> --- a/drivers/net/vmxnet3/vmxnet3_drv.c
> +++ b/drivers/net/vmxnet3/vmxnet3_drv.c
> @@ -1614,7 +1614,8 @@ vmxnet3_rq_rx_complete(struct vmxnet3_rx_queue *rq,
> adapter->rx_prod_offset, adapter->rx_prod2_offset
> };
> u32 num_pkts = 0;
> - bool skip_page_frags = false;
> + /* A frame dropped at its head may continue in the next poll. */
> + bool skip_page_frags = !rq->rx_ctx.skb;
[Severity: Medium]
This initialization also fixes an older crash in the non-XDP rx path. The
commit message says so:
This also changes the non-XDP rx path, whose head buffer drops (skb
allocation or DMA mapping failure) had the same problem before XDP
support was added
Here is the sequence in vmxnet3_rq_rx_complete(). If
netdev_alloc_skb_ip_align() or dma_map_single() fails on a head buffer,
ctx->skb is set to NULL and skip_page_frags to true. The loop then exits
because rcd->gen does not yet match rq->comp_ring.gen for the body
completion. The next poll used to start with skip_page_frags == false, so
the orphan body hit:
BUG_ON(ctx->skb == NULL && !skip_page_frags);
That BUG_ON and the skip_page_frags handling appear to come from commit
5318d809d7b4 ("vmxnet3: fix starving rx ring whenoc_skb kb fails") from
2011. The only tag here is:
Fixes: 54f00cce1178 ("vmxnet3: Add XDP support.")
which landed in v6.6.
Will stable trees that have the non-XDP code but not vmxnet3 XDP miss this
crash fix? The fix is mixed in with XDP-only code (VMXNET3_RX_BUF_XDP,
vmxnet3_xdp_enabled()), so it also looks hard to cherry-pick into those
trees.
Could the non-XDP part go into a separate patch with its own
Fixes: 5318d809d7b4 tag? That part is the poll-start skip_page_frags
initialization, the eop/err skip for an already dropped frame, and the
extra drop_total accounting. Failing that, could this patch at least carry
the additional tag?
> bool encap_lro = false;
> struct Vmxnet3_RxCompDesc *rcd;
> struct vmxnet3_rx_ctx *ctx = &rq->rx_ctx;
[ ... ]
> + if (rcd->sop && !rcd->eop &&
> + rbi->buf_type == VMXNET3_RX_BUF_XDP &&
> + !VMXNET3_RX_DATA_RING(adapter, rcd->rqID)) {
> + /* The frame did not fit one XDP buffer. XDP here is
> + * single-buffer and the head holds a page, not an
> + * skb: drop the frame, reuse the head buffer and
> + * skip the body buffers.
> + */
> + rq->stats.drop_total++;
> + ctx->skb = NULL;
> + skip_page_frags = true;
> + goto rcd_done;
> + }
> +
> if (rcd->sop && rcd->eop && vmxnet3_xdp_enabled(adapter)) {
> struct sk_buff *skb_xdp_pass;
> int act;
[Severity: High]
This is a pre-existing issue, not one introduced by this patch, but it sits
in the same XDP rx path. Can vmxnet3_process_xdp() in vmxnet3_xdp.c leave
the rx descriptor pointing at a page it has already given away?
On XDP_PASS the head page goes into an skb, and on a successful XDP_TX or
XDP_REDIRECT it goes to the TX ring or the redirect target. Only then is a
replacement allocated:
drivers/net/vmxnet3/vmxnet3_xdp.c:vmxnet3_process_xdp() {
...
if (act == XDP_PASS) {
out_skb:
*skb_xdp_pass = vmxnet3_build_skb(rq, page, &xdp);
...
}
new_data = vmxnet3_pp_get_buff(rq->page_pool, &new_dma_addr,
GFP_ATOMIC);
if (!new_data) {
rq->stats.rx_buf_alloc_failure++;
return XDP_DROP;
}
rbi->page = virt_to_page(new_data);
rbi->dma_addr = new_dma_addr;
rxd->addr = cpu_to_le64(rbi->dma_addr);
...
}
When that GFP_ATOMIC allocation fails, rbi->page, rbi->dma_addr and
rxd->addr are left unchanged. The caller in vmxnet3_rq_rx_complete() then
sees XDP_DROP. It sets ctx->skb = NULL, which leaks the skb just built in
the PASS case. It does not set need_flush for a redirect that already
succeeded. Then it jumps to rcd_done.
The refill at rcd_done sets rxd->gen = ring->gen and gives the descriptor
back to the device with the old DMA address. The device can then DMA new rx
data into a page that is being transmitted or is owned by a redirect target.
After TX completion that page can go back into the page pool and be handed
to another rx descriptor. If the pool is full, it can be released and
unmapped while this ring still points at it.
The XDP_DROP and XDP_ABORTED verdicts, and failed TX or redirect, look safe
because page_pool_recycle_direct() refills the alloc cache just before the
allocation. Should the replacement buffer be allocated before the page is
handed off, or should a failed refill keep the descriptor out of the ring?
>
> if (VMXNET3_RX_DATA_RING(adapter, rcd->rqID)) {
> ctx->skb = NULL;
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261125075255.1517-1-filzador%40gmail.com
next prev parent reply other threads:[~2026-11-29 8:27 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-25 7:52 [PATCH net v3 0/5] vmxnet3: fix native XDP crash on oversized frames and XDP loss on reset Philipp Sudakas
2026-11-25 7:52 ` [PATCH net v3 1/5] vmxnet3: clear rx_ctx.skb after a data ring XDP verdict Philipp Sudakas
2026-11-25 7:52 ` [PATCH net v3 2/5] vmxnet3: fix the error path of XDP program setup Philipp Sudakas
2026-11-29 8:27 ` netdev-bot+sashiko
2026-11-25 7:52 ` [PATCH net v3 3/5] vmxnet3: limit the XDP MTU to the rx head buffer size Philipp Sudakas
2026-11-25 7:52 ` [PATCH net v3 4/5] vmxnet3: drop XDP frames that do not fit in one rx buffer Philipp Sudakas
2026-11-29 8:27 ` netdev-bot+sashiko [this message]
2026-11-25 7:52 ` [PATCH net v3 5/5] vmxnet3: keep the XDP program across device resets Philipp Sudakas
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=179594087560.3146.8294301865977150437@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=andrew+netdev@lunn.ch \
--cc=ast@kernel.org \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=filzador@gmail.com \
--cc=hawk@kernel.org \
--cc=john.fastabend@gmail.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=ronak.doshi@broadcom.com \
--cc=sdf@fomichev.me \
--cc=u9012063@gmail.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox