Article View: linux.kernel.netdev
Article #20628Re: [PATCH net 2/2] vmxnet3: keep the XDP program across device resets
From: netdev-bot+sashiko
Date: Mon, 23 Nov 2026 01:06
Date: Mon, 23 Nov 2026 01:06
127 lines
12224 bytes
12224 bytes
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.
Critical: 1 ยท High: 0 ยท Medium: 0 ยท 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).
- [Critical] On a failed XDP attach, the patch leaves a dangling bpf_prog
pointer in adapter->xdp_bpf_prog.
--
vmxnet3: keep the XDP program across device resets
This patch stops vmxnet3_rq_cleanup_all() from clearing
adapter->xdp_bpf_prog. The attached XDP program then survives the
quiesce and reset paths, such as MTU changes, down/up and ring resizes.
It also rejects MTU changes above VMXNET3_XDP_MAX_MTU while XDP is
attached.
> diff --git a/drivers/net/vmxnet3/vmxnet3_drv.c b/drivers/net/vmxnet3/vmxnet3_drv.c
> index fb98eb7712584..e84bf116a3baf 100644
> --- a/drivers/net/vmxnet3/vmxnet3_drv.c
> +++ b/drivers/net/vmxnet3/vmxnet3_drv.c
> @@ -2104,7 +2104,6 @@ vmxnet3_rq_cleanup_all(struct vmxnet3_adapter *adapter)
>
> for (i = 0; i < adapter->num_rx_queues; i++)
> vmxnet3_rq_cleanup(&adapter->rx_queue[i], adapter);
> - rcu_assign_pointer(adapter->xdp_bpf_prog, NULL);
> }
[Severity: Critical]
If an XDP attach fails inside vmxnet3_xdp_set(), does removing this line
leave a dangling program pointer in adapter->xdp_bpf_prog?
vmxnet3_xdp_set() publishes the new program and drops the old one before
it rebuilds and reactivates the device:
drivers/net/vmxnet3/vmxnet3_xdp.c:vmxnet3_xdp_set() {
...
vmxnet3_xdp_exchange_program(adapter, new_bpf_prog);
if (old_bpf_prog)
bpf_prog_put(old_bpf_prog);
...
err = vmxnet3_activate_dev(adapter);
if (err) {
NL_SET_ERR_MSG_MOD(extack,
"failed to activate device for XDP.");
return -EOPNOTSUPP;
}
...
}
When ndo_bpf fails, dev_xdp_install() in net/core/dev.c drops the
reference it took for the driver. It also does not record the program:
err = bpf_op(dev, &xdp);
if (err) {
if (prog)
bpf_prog_put(prog);
return err;
}
Before this patch, every error label in vmxnet3_activate_dev()
(activate_err, irq_err, rq_err) went through vmxnet3_rq_cleanup_all().
As a side effect, that reset adapter->xdp_bpf_prog to NULL. With the line
removed, nothing clears the pointer on that path.
vmxnet3_activate_dev() can fail in three ways:
- vmxnet3_rq_init_all() returns -ENOMEM because vmxnet3_create_pp() or
vmxnet3_rq_alloc_rx_buf() failed.
- vmxnet3_request_irqs() fails.
- The device rejects VMXNET3_CMD_ACTIVATE_DEV.
The vmxnet3_rq_create_all() error return in vmxnet3_xdp_set() leaves the
pointer in the same state.
Take an attach of program P on a running interface (old NULL, new P).
After this failure, adapter->xdp_bpf_prog == P, but neither the driver
nor the core holds a reference to P. Once userspace closes the prog fd,
P and its JIT image are freed.
vmxnet3_xdp_enabled() still returns true, so on the next down/up the rx
rings are rebuilt in XDP mode:
vmxnet3_open()
vmxnet3_activate_dev()
vmxnet3_rq_init_all()
vmxnet3_rq_init()
buf_type = VMXNET3_RX_BUF_XDP
Received packets then go from vmxnet3_rq_rx_complete() into
vmxnet3_process_xdp() or vmxnet3_process_xdp_small(), which do:
xdp_prog = rcu_dereference(rq->adapter->xdp_bpf_prog);
Could this run the freed program on every received packet?
A later attach of another program would see old_bpf_prog == P and call
bpf_prog_put() on the freed program. dev_xdp_uninstall() only calls
ndo_bpf for modes the core has recorded, so unregister would not clear
the stale pointer either.
The detach case (old P, new NULL) can still end up in the same state.
The same failure leaves the driver with NULL after P has already been
put, while the core still reports P as attached. That is the core/driver
disagreement the commit message describes.
The commit message says:
"The program is exchanged and released by vmxnet3_xdp_set()"
The error paths in vmxnet3_xdp_set() do not roll back the exchange,
though. Would it be safer to publish the new program and put the old one
only after vmxnet3_activate_dev() succeeds? Another option would be to
restore old_bpf_prog on the error paths without dropping its reference.
[ ... ]
--
Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261122002847.616-1-filzador%40gmail.com
Technical Details
Message-ID:
<179539597786.3135.350150131775018719@kernel.org>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-368931-linux-kernel-netdev=dewy.ruReferences:
<20261122002847.616-3-filzador@gmail.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-368931-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net 2/2] vmxnet3: keep the XDP program across device resets Date: Mon, 23 Nov 2026 01:06:17 +0000 Organization: Usenet Network Message-ID: <179539597786.3135.350150131775018719@kernel.org> References: <20261122002847.616-3-filzador@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="3760037"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:z+ITE3PDV8YGI4j1B58KGOGlK6g= sha256:Nr0slzNs288pyFQ+BFjvsBex9Z2nWBqNOR0Rj04qlSc= sha1:hwgvOTwLFMGu00aDnpbnzdqpmZM= sha256:PQjdFc5Y8WCUC0DbSYbaPTukCUjEu6cGSo8KLoIEzAU= 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 98A4B125D88; Mon, 23 Nov 2026 04:06:44 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.401 X-Spam-Status: No, score=-3.401 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] 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 X-l1VqZyaE_o; Mon, 23 Nov 2026 04:06:41 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-368931-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 B2B3C125D87; Mon, 23 Nov 2026 04:06:32 +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 EC1682B23B; Mon, 23 Nov 2026 01:06:19 +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=1795395979; b=PAYmhdamp/E6G6zLniYzUw9x8OAGV8JMrG9QApsU/YNUIg3BGkCHxTr5iYw+LaaOP6Eq pfzjtXvVHHRvPp+TT14yoxgujTlIX7tmJWI5t3rU8rTwBuEav8inQvMfiNxJokVNXh2Zd lUqDZ8c41tChIpbMVPnBNfZBBG7FbwqQbr6bBWgWTjMv585r5b0r6NhtmZWfSMEVS3WxI RxQBMKuLq4LFwp4Gfo7dn48EvJQy3j5+i2naoUpTvU8xQtTRFBD0yZapJXpHSSPXy8KiN CsFkUhdDosbodyy5B4dmBqfA0Hlvdg5yci7LA48lwjYzSqqHOLzFNR6dOqAcFRftzqg== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795395979; 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=lRX8+TAe/A3hOjyZQJpqESHbzA31Kj7ZIZkFU1RGn48=; b=GdgEjCbKFkEB9vr8fGmqmg2Be/B1lM2ik/+/Ir045xSMHu+GImMPXMyCp1p+sCVCwEac 0+Y6+i3KsbEW7vYDx7oq9McitH2Qw0Sz+fLpSZ4ixv4JShiHeD2qd2zCEcLNJpIxh8v1B q80wGxQhM9x3ySw571gAPla95gL6bwPX5hpuyqPliNDDpGmnYanjga5XvvtpfzZtXhu/I yXcvG8uy+BARLhDXdhuA/DCyYoox4wjZJ1jYob2HZj2DZoq0Grk9dkMDp+rPVieULGHCW jX26z/VCc3JScjoudN/C84c8x+Rso59arcAFWx+i+kHVAIH7B0ahp0Nzyhi4ZQsostw== 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=aDK36XgV; 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 91124606A32D; Mon, 23 Nov 2026 01:06:19 +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=aDK36XgV 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=1795395978; b=xcirmul93JtuWbGUvAqUjAbAxNcUBmmqq7iQaF/M7Jc6ve5QoR5dtu4tWS+T0Xgpd+y7 1V3hZ+r+4d5AZbM2mhCCyUQullXfxu4z42He9zO71SwjvSpGhviGXfY9gVD9r/6hPEw/G m/v63Fb2IoPVlHsNdo4OJaSb49hjheawGuddLdvB30H2Mj/FklqS9GPVrMDbK8uIIjQtj hpShjdjUkh/E51UpjSHO8CdB3aLhhOOme6h7+01dJqWSdgWaAo953xZz1TDvD9/kAt10o B7bMPf5F1b+cFca6SuMu8e7u6GP7jqp1igReGgK++5gRFz2YmiJY2HuumQX+5jHOTWQ== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795395978; 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=lRX8+TAe/A3hOjyZQJpqESHbzA31Kj7ZIZkFU1RGn48=; b=Ji0P2btIpDXvxq11IO7p2jDzrI5WJpih3JVj9VOwmp68oFYVhXUoYb6YFsNdTGd7ClzZ fVpULIK32O5mSr427JYOUT0TcJtdHhhJ2ExSy0KBu7GCLL+JxDwfQSpLStTkqTD9NUkYX mIsPBy0wBp7e0yWWR7xtYKXYvdfyc2/2dnjV95QD6CEKgql7rWRi/y9z24Y65CFxPwZ+e XXEB65J3OK/detb6S0yX3XglheVJeCTne/LRyI4XLbNdHxjlAdYuNrrH4RXbpcPcLUAsH yTGwGjcQxIoQzeFwgN9n4ofzUCGYCU/IdGeuPguRMfyeHNdfyV637UNzwL8e9RfKakw== 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=aDK36XgV; 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 B20D3606A32C for <netdev@vger.kernel.org>; Mon, 23 Nov 2026 01:06:18 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 45D931F000C4; Mon, 23 Nov 2026 01:06:18 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795395978; bh=lRX8+TAe/A3hOjyZQJpqESHbzA31Kj7ZIZkFU1RGn48=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=aDK36XgVjtrozghjMQye3X4wfuXlH5dliW3XQ6MzM/YV1Flk+WkjJ/x9/us17myDF B01FnWUfj0X+YkyRouAM1rSVyZKoWfhWLT455oxv1ekqbc79KddPsCTKe1NzEOSWDG xC+T6lHvp0wXXipCI2687GnUQFIK1wXzlhXN71D3yEP3n3TcvUAP9tGj2gZVwWv6/X K9pjt31SEB8CWOlTMtyxrlodmKU2j8zA0+CkpvkOE1Nb6IUpBP1Ee/ns/EWfx53CHt cHLY/0FP+BMDryVlOnhZZEJF8GWm2KqGmG/c/BgxFOOCYYEP6Nu2CYYYw9243BuNWx WecGmEYjM1ifw== X-Cc: ronak.doshi@broadcom.com, bcm-kernel-feedback-list@broadcom.com, netdev@vger.kernel.org, kuba@kernel.org X-In-Reply-To: <20261122002847.616-3-filzador@gmail.com> X-sashiko-severity: Critical 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