🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #24088

Re: [PATCH net v3 4/5] vmxnet3: drop XDP frames that do not fit in one rx buffer

#24088
From: netdev-bot+sashiko
Date: Sun, 29 Nov 2026 08:27
158 lines
13976 bytes
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
Technical Details
Message-ID: <179594087560.3146.8294301865977150437@kernel.org>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-373416-linux-kernel-netdev=dewy.ru
References: <20261125075255.1517-5-filzador@gmail.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-373416-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
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
Organization: Usenet Network
Message-ID: <179594087560.3146.8294301865977150437@kernel.org>
References: <20261125075255.1517-5-filzador@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="1132920"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:Pu+zj9/0xm9wVWA4V7ygoZsMmOM= sha256:8UMX5dDaOpYamtfsTio7Wf/VrkSxSOywcUQhSuio74c=
	sha1:bEqnTjR+pkroPnKbe685MkfXFTs= sha256:cgcvDg5mtE1RdvQe80G4bX43vCHJC21sLKvDBz69XeE=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id 291C7125F96; Sun, 29 Nov 2026 11:28:22 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.4
X-Spam-Status: No, score=-3.4 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1,
	DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=kernel.org
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id LCZaWRZ0uXjP;
	Sun, 29 Nov 2026 11:28:17 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-373416-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 21445125F95; Sun, 29 Nov 2026 11:28:06 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sea.lore.kernel.org (Postfix) with ESMTP id 2E4D7251F4; Sun, 29 Nov 2026 08:28:03 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1795940883;
	b=Dk69z3glqX0g/IiGpzHyCpaX7/Z7aoq9MIpJPV8+YJBy64qffHWuUZpwVPFat34KHPLc
	 WFKJL7CB9iTXE9AhXCCDv0G8KNJLApLecVQXYsiYWv5SMeMYyzKmVWklZca8itw9NAIWq
	 KAb2EBRcKFkanQP+lBy5yVs+c4VyG00JCQcwKFVdVvvf9oHVq38S4DTTXBJgCKVA6JVCz
	 Vr2ljptVRSFO22eog/uJy4WefCqXAnQsTLdumcPVn2nX9vuLseMnSoE76T9DWkVOU4dRE
	 lOXaNBe/Gd8fsBdmTJjtVSnVYddQUSyDTfyQ5NNFgYzQeqApen7JT5Oc+s38JcQPibw==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795940883;
	h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc:
	 Date:Message-ID:In-Reply-To:References:X-sashiko-severity:
	 Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id:
	 List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
	 Precedence:MIME-Version;
	bh=LzMRAHUometdg54yhhZDhAm3bbj/wdX2smHuy6837qw=;
	b=IDLbgAF+189GBRQ0w4/WDk8uxadaiqiOhn9eohsJ4CanP15UDwKvgSbULpt5T3vhibDu
	 O+gCeiIGuTJ8PzDXuPN1Njb4b3uX7ekI/Ii/yahNM7r7350DHzlsjMvjp5oxEPcr4l+Xp
	 IImydAKDb51G3zXVQbuubp3BqDazT50du2TSSbXwbjKjrfh1KXPc3Bsl2/6hOmT46xJNx
	 AJtLM4wdFh9Nty7S7Ccizsq+/EP1jo/ENs+FR2DoSm6+TLCeILI+AgX0V0e8VPkbfxti+
	 Ar52svOUxoBoBDIkydc45e3krdNhz4iTkD7mhkJkTZnLDGUo+SB6L4iCbXCCXAOJp3g==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=NDWKSQha;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 06898606A329;
	Sun, 29 Nov 2026 08:28:03 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=NDWKSQha
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1795940877;
	b=QT0NhZahx6CnT/Z6FgdEaxQdd5RWRKnKEV8WbPlZr4ncnvwQPfuzb1LPRNTYzETVrYdl
	 selyfCLPEE0Qvmmp9O3kBXGtH7+ouaYRzSHA+atBoXKAIqhRwLHc4shoc+QAF9HRDYiAE
	 l+9nMofNTy40tTTL6LnbsQPnSzhp35fk1bjElzDkE0jaftkGv2W6Yvf6vo4dCblXwrJzI
	 O8/WJNTLjDG882gh7wlgn0zw2LNjy8a3Lm7RNog6rneFRqk7So1JRc27DpjMksdutrUt9
	 q/zuscJBtbCjpU0xMgXfcm8j2hFUJxdIvhZrty2mjaI4hSplAeeA6PHrVj9TGvj1SIA==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795940877;
	h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID:
	 In-Reply-To:References:X-sashiko-severity:Content-Type:
	 Content-Transfer-Encoding:MIME-Version;
	bh=LzMRAHUometdg54yhhZDhAm3bbj/wdX2smHuy6837qw=;
	b=OdzmsBwgYq27hrPtgPb4TlsHNIN6GNeY3cxA+FdSJf//iKUCMytQwz6Wb3Y9VmIhdtAQ
	 zFMfN3hZSQne9q7f1V8zjhjpwY8bO6TdJvZNwf4LPj7m09Lr4QbKJjxgTOKvlnalO0fEl
	 jG23yXqPXNKPusJYUunRFDIpBg7UV9bL2VjyVDxqZm478BaM0gE9h5XJfv4bCZDPhA6Qa
	 x9Dx/CbsPqpJNksT+cNBkNBpeYP7Qixxut/cJ7yExc5GRVY8SIYx1pd7H4or454UZbk+B
	 F/10MyTjJvo0Wic1OHUlv5158aff725KT4wV/mJVvk6WS/dq3iIoERvLiSR7/GZCBkg==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=NDWKSQha;
	arc=none smtp.remote-ip=100.103.45.18
X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 22384606A32D;
	Sun, 29 Nov 2026 08:27:56 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 04C9A1F000C1;
	Sun, 29 Nov 2026 08:27:55 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1795940876;
	bh=LzMRAHUometdg54yhhZDhAm3bbj/wdX2smHuy6837qw=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=NDWKSQhalWsUdyUpaUQgTE/4bhqBK+4nLEEoQFt/1paNg76c1paSWGPSeitGeVu5D
	 97O8rcndtz45n7r51hST5DK0onGEBaSwbW74VXazoSo6w32uDq5PkdvMSfbgmQJGDG
	 njIGQwu1zASeXzEOxa4cFmYMv9oRRzxjhOcuOdLSyCeQ6JZ3gWPUxLrXPN58ja9Jep
	 d88D4tK+vFn5eQnAa3IzuKA0HPvZBctL7xbIsqmZHd8st48KtyMJ9ZTGnAUuifzDLH
	 nROQNAp9DCppT5K11RYe/K+o7CpEs0nDCfEU5GFpoZJc6SnVEZUIxQMjwdWmsJR6Im
	 9xI3edMG/NAiQ==
X-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
X-In-Reply-To: <20261125075255.1517-5-filzador@gmail.com>
X-sashiko-severity: Medium
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list