From: sashiko-bot@kernel.org
To: "Harshitha Ramamurthy" <hramamurthy@google.com>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH net-next v4 01/15] gve: don't pass in unused parameter to gve_adminq_free
Date: Sat, 15 Aug 2026 02:14:35 +0000 [thread overview]
Message-ID: <20260815021435.85BC01F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260814021406.3044324-2-hramamurthy@google.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
Pre-existing issues:
- [High] Workqueue is destroyed after freeing resources in gve_remove, leading to resource leaks and UAF if a reset is pending.
- [High] Hardware device resources are not deconfigured before DMA memory is freed in the gve_setup_device_resources error path.
--
--- Patch [1]: [PATCH net-next v4 01/15] gve: don't pass in unused parameter to gve_adminq_free ---
commit 9a4a2e123b2090a5f84279c50fa3476f0a484a87
Author: Harshitha Ramamurthy <hramamurthy@google.com>
gve: don't pass in unused parameter to gve_adminq_free
Clean up gve_adminq_free to not take in an unused parameter.
> diff --git a/drivers/net/ethernet/google/gve/gve_main.c b/drivers/net/ethernet/google/gve/gve_main.c
> index e4d78ae52dafe..30bf6df4ebc58 100644
> --- a/drivers/net/ethernet/google/gve/gve_main.c
> +++ b/drivers/net/ethernet/google/gve/gve_main.c
> @@ -2506,14 +2506,14 @@ static int gve_init_priv(struct gve_priv *priv, bool skip_describe_device)
> bitmap_free(priv->xsk_pools);
> priv->xsk_pools = NULL;
> err:
> - gve_adminq_free(&priv->pdev->dev, priv);
> + gve_adminq_free(priv);
> return err;
> }
[Severity: High]
This is a pre-existing issue, but does the error path in
gve_setup_device_resources() leave hardware configured with freed DMA
addresses?
If an initialization step fails after configuring the hardware, the error path
frees the DMA memory without deconfiguring or resetting the hardware:
drivers/net/ethernet/google/gve/gve_main.c:gve_setup_device_resources() {
...
err = gve_adminq_configure_device_resources(...);
...
abort_with_ntfy_blocks:
gve_free_notify_blocks(priv);
abort_with_counter:
gve_free_counter_array(priv);
...
}
Can this allow the hardware to asynchronously write to the freed DMA addresses
until it is finally reset later by the gve_adminq_free() call in
gve_init_priv(), causing a use-after-free?
> static void gve_teardown_priv_resources(struct gve_priv *priv)
> {
> gve_teardown_device_resources(priv);
> - gve_adminq_free(&priv->pdev->dev, priv);
> + gve_adminq_free(priv);
> bitmap_free(priv->xsk_pools);
> priv->xsk_pools = NULL;
> }
[Severity: High]
This is a pre-existing issue, but can the sequence in gve_remove() lead to a
resource leak and use-after-free if a reset is pending?
In gve_remove(), teardown is performed before the workqueue is destroyed, and
the service task is not cancelled:
drivers/net/ethernet/google/gve/gve_main.c:gve_remove() {
...
gve_teardown_priv_resources(priv);
destroy_workqueue(priv->gve_wq);
free_netdev(netdev);
...
}
If a device reset is requested or handled by gve_service_task() concurrently
with module removal:
1. unregister_netdev() drops the rtnl_lock.
2. The pending gve_service_task() acquires the lock and allocates new device
resources during reset recovery.
3. Concurrently, gve_remove() calls gve_teardown_priv_resources() without
rtnl_lock, racing with the reset teardown/recovery.
4. destroy_workqueue() waits for the service task to complete.
5. gve_remove() calls free_netdev().
Are the newly allocated resources from the reset recovery leaked, leaving the
hardware active to DMA into freed structures?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260814021406.3044324-1-hramamurthy@google.com?part=1
next prev parent reply other threads:[~2026-08-15 2:14 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-14 2:13 [PATCH net-next v4 00/15] gve: AdminQ mode related refactors Harshitha Ramamurthy
2026-08-14 2:13 ` [PATCH net-next v4 01/15] gve: don't pass in unused parameter to gve_adminq_free Harshitha Ramamurthy
2026-08-15 2:14 ` sashiko-bot [this message]
2026-08-14 2:13 ` [PATCH net-next v4 02/15] gve: refactor initialization with helper functions Harshitha Ramamurthy
2026-08-15 2:14 ` sashiko-bot
2026-08-14 2:13 ` [PATCH net-next v4 03/15] gve: add a few helper functions to set device properties Harshitha Ramamurthy
2026-08-14 2:13 ` [PATCH net-next v4 04/15] gve: add struct gve_device_info to hold " Harshitha Ramamurthy
2026-08-15 2:14 ` sashiko-bot
2026-08-14 2:13 ` [PATCH net-next v4 05/15] gve: introduce control plane operations structure Harshitha Ramamurthy
2026-08-15 2:14 ` sashiko-bot
2026-08-14 2:13 ` [PATCH net-next v4 06/15] gve: introduce ctrl ops to set vectors and Qs Harshitha Ramamurthy
2026-08-15 2:14 ` sashiko-bot
2026-08-14 2:13 ` [PATCH net-next v4 07/15] gve: introduce gve_adminq_get_device_properties() Harshitha Ramamurthy
2026-08-14 2:13 ` [PATCH net-next v4 08/15] gve: refactor gve_init_priv for reset path Harshitha Ramamurthy
2026-08-15 2:14 ` sashiko-bot
2026-08-14 2:13 ` [PATCH net-next v4 09/15] gve: simplify reset logic Harshitha Ramamurthy
2026-08-15 2:14 ` sashiko-bot
2026-08-14 2:14 ` [PATCH net-next v4 10/15] gve: add gve_ctrl_ops for gve initialization/teardown sequences Harshitha Ramamurthy
2026-08-14 2:14 ` [PATCH net-next v4 11/15] gve: split up notify block allocation and setup paths Harshitha Ramamurthy
2026-08-14 2:14 ` [PATCH net-next v4 12/15] gve: introduce new methods to handle IRQ doorbells Harshitha Ramamurthy
2026-08-14 2:14 ` [PATCH net-next v4 13/15] gve: setup and teardown management interrupts Harshitha Ramamurthy
2026-08-14 2:14 ` [PATCH net-next v4 14/15] gve: add ctrl ops to for queue operations Harshitha Ramamurthy
2026-08-15 2:14 ` sashiko-bot
2026-08-14 2:14 ` [PATCH net-next v4 15/15] gve: add link status/speed ctrl ops Harshitha Ramamurthy
2026-08-15 2:14 ` sashiko-bot
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=20260815021435.85BC01F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=hramamurthy@google.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox