From: sashiko-bot@kernel.org
To: "Harshitha Ramamurthy" <hramamurthy@google.com>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH net-next v3 08/15] gve: refactor gve_init_priv for reset path
Date: Tue, 04 Aug 2026 18:47:00 +0000 [thread overview]
Message-ID: <20260804184701.43FAE1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260803184630.3813311-9-hramamurthy@google.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
Pre-existing issues:
- [High] AF_XDP zero-copy socket pool bindings are broken and their DMA mappings are leaked across device resets.
- [High] Concurrent use-after-free and NULL pointer dereference of `priv->stats_report` during `gve_stats_report_task`.
--
--- Patch [8]: [PATCH net-next v3 08/15] gve: refactor gve_init_priv for reset path ---
commit 02971463a0e35f7deed56d888e3c49b020365965
Author: Harshitha Ramamurthy <hramamurthy@google.com>
gve: refactor gve_init_priv for reset path
This patch refactors device initialization into distinct steps by introducing
gve_setup_device() and gve_adminq_init(). It reorganizes device properties
configuration to ensure gve_init_priv() is only called once, preparing the
driver for upcoming mailbox mode additions.
> diff --git a/drivers/net/ethernet/google/gve/gve_main.c b/drivers/net/ethernet/google/gve/gve_main.c
> --- a/drivers/net/ethernet/google/gve/gve_main.c
> +++ b/drivers/net/ethernet/google/gve/gve_main.c
[ ... ]
> @@ -2414,6 +2414,35 @@ static void gve_set_buf_sizes(struct gve_priv *priv)
> priv->header_buf_size = device_info->header_buf_size;
> }
>
> +static int gve_setup_device(struct gve_priv *priv)
> +{
> + int err;
> +
> + priv->num_registered_pages = 0;
> +
> + priv->xsk_pools = bitmap_zalloc(priv->rx_cfg.max_queues, GFP_KERNEL);
[Severity: High]
This isn't a bug introduced by this patch, but does this unconditionally
overwrite the existing AF_XDP zero-copy socket pool bindings across a reset?
When a reset occurs (e.g., via MTU change or watchdog timeout),
gve_setup_device() re-allocates priv->xsk_pools as a new, zeroed bitmap. The
old bitmap is freed during teardown, but the previously bound XSK pools do
not appear to be restored.
Consequently, when queues are restarted, wouldn't gve_get_xsk_pool() return
NULL, causing XDP zero-copy registration to be skipped and fall back to
standard memory models (PAGE_SHARED/PAGE_POOL)?
> + if (!priv->xsk_pools) {
> + err = -ENOMEM;
> + goto err;
> + }
> +
> + gve_set_netdev_xdp_features(priv);
> + if (!gve_is_gqi(priv))
> + priv->dev->xdp_metadata_ops = &gve_xdp_metadata_ops;
> +
> + err = gve_setup_device_resources(priv);
> + if (err)
> + goto err_free_xsk_bitmap;
> +
> + return 0;
> +
> +err_free_xsk_bitmap:
> + bitmap_free(priv->xsk_pools);
> + priv->xsk_pools = NULL;
> +err:
> + return err;
> +}
[Severity: High]
This is a pre-existing issue, but since this patch refactors the device setup
and reset recovery paths, could there be a race condition when tearing down
the stats report?
In gve_free_stats_report(), the stats timer is deleted and the stats_report
DMA memory is freed. However, it does not call
cancel_work_sync(&priv->stats_report_task).
If the gve_stats_report_task executes asynchronously on priv->gve_wq during
or immediately after the memory is freed, could it lead to a use-after-free
or NULL pointer dereference when accessing priv->stats_report->stats in
gve_handle_report_stats()?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260803184630.3813311-1-hramamurthy@google.com?part=8
next prev parent reply other threads:[~2026-08-04 18:47 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-03 18:46 [PATCH net-next v3 00/15] gve: AdminQ mode related refactors Harshitha Ramamurthy
2026-08-03 18:46 ` [PATCH net-next v3 01/15] gve: don't pass in unused parameter to gve_adminq_free Harshitha Ramamurthy
2026-08-04 18:46 ` sashiko-bot
2026-08-03 18:46 ` [PATCH net-next v3 02/15] gve: refactor initialization with helper functions Harshitha Ramamurthy
2026-08-03 18:46 ` [PATCH net-next v3 03/15] gve: add a few helper functions to set device properties Harshitha Ramamurthy
2026-08-03 18:46 ` [PATCH net-next v3 04/15] gve: add struct gve_device_info to hold " Harshitha Ramamurthy
2026-08-04 18:46 ` sashiko-bot
2026-08-06 7:19 ` Przemek Kitszel
2026-08-03 18:46 ` [PATCH net-next v3 05/15] gve: introduce control plane operations structure Harshitha Ramamurthy
2026-08-03 18:46 ` [PATCH net-next v3 06/15] gve: introduce ctrl ops to set vectors and Qs Harshitha Ramamurthy
2026-08-06 7:33 ` Przemek Kitszel
2026-08-03 18:46 ` [PATCH net-next v3 07/15] gve: introduce gve_adminq_get_device_properties() Harshitha Ramamurthy
2026-08-03 18:46 ` [PATCH net-next v3 08/15] gve: refactor gve_init_priv for reset path Harshitha Ramamurthy
2026-08-04 18:47 ` sashiko-bot [this message]
2026-08-03 18:46 ` [PATCH net-next v3 09/15] gve: simplify reset logic Harshitha Ramamurthy
2026-08-04 18:47 ` sashiko-bot
2026-08-06 1:37 ` Jakub Kicinski
2026-08-03 18:46 ` [PATCH net-next v3 10/15] gve: add gve_ctrl_ops for gve initialization/teardown sequences Harshitha Ramamurthy
2026-08-04 18:47 ` sashiko-bot
2026-08-03 18:46 ` [PATCH net-next v3 11/15] gve: split up notify block allocation and setup paths Harshitha Ramamurthy
2026-08-03 18:46 ` [PATCH net-next v3 12/15] gve: introduce new methods to handle IRQ doorbells Harshitha Ramamurthy
2026-08-04 18:47 ` sashiko-bot
2026-08-03 18:46 ` [PATCH net-next v3 13/15] gve: setup and teardown management interrupts Harshitha Ramamurthy
2026-08-03 18:46 ` [PATCH net-next v3 14/15] gve: add ctrl ops to for queue operations Harshitha Ramamurthy
2026-08-04 18:47 ` sashiko-bot
2026-08-03 18:46 ` [PATCH net-next v3 15/15] gve: add link status/speed ctrl ops Harshitha Ramamurthy
2026-08-04 18:47 ` 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=20260804184701.43FAE1F000E9@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