From: sashiko-bot@kernel.org
To: "Harshitha Ramamurthy" <hramamurthy@google.com>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH net-next v2 13/15] gve: setup and teardown management interrupts
Date: Wed, 03 Jun 2026 23:59:31 +0000 [thread overview]
Message-ID: <20260603235931.B038A1F00893@smtp.kernel.org> (raw)
In-Reply-To: <20260602235900.3050782-14-hramamurthy@google.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
Pre-existing issues:
- [High] The workqueue `priv->gve_wq` is destroyed before the management IRQ is freed in `gve_remove()`, leading to a use-after-free if the interrupt fires during device teardown.
- [High] `stats_report_task` is not canceled when freeing the stats report, leading to a NULL pointer dereference if the interface is reset while down.
--
commit bb3bcdd68440531b8ea4f0e46ef000aabc8d097d
Author: Joshua Washington <joshwash@google.com>
gve: setup and teardown management interrupts
Introduce control ops to setup/teardown control plane IRQs. Admin
queue-specific functionality is moved to admin queue files.
> diff --git a/drivers/net/ethernet/google/gve/gve_main.c b/drivers/net/ethernet/google/gve/gve_main.c
> index 7b034b439cebb..8005373e91bde 100644
> --- a/drivers/net/ethernet/google/gve/gve_main.c
> +++ b/drivers/net/ethernet/google/gve/gve_main.c
> @@ -267,14 +267,6 @@ static void gve_free_stats_report(struct gve_priv *priv)
> priv->stats_report = NULL;
> }
[Severity: High]
This is a pre-existing issue, but does this function fail to cancel
the stats_report_task?
gve_free_stats_report() calls timer_delete_sync(&priv->stats_report_timer),
but it does not call cancel_work_sync(&priv->stats_report_task).
If the user enables stats reporting while the interface is down, the timer
starts. If a reset is triggered while the interface is down, gve_reset() skips
gve_queues_stop() (where the task is normally canceled) and proceeds to
teardown.
gve_free_control_plane_resources() then calls gve_free_stats_report(), which
frees priv->stats_report and sets it to NULL.
If the stats_report_task was queued just before the timer was deleted, it would
execute asynchronously and call gve_handle_report_stats(), which unconditionally
dereferences priv->stats_report->stats.
Could this lead to a NULL pointer dereference?
[ ... ]
> @@ -499,6 +491,7 @@ static int gve_alloc_notify_blocks(struct gve_priv *priv)
>
> static void gve_teardown_notify_blocks(struct gve_priv *priv)
> {
> + const struct gve_ctrl_ops *ops = priv->ctrl_ops;
> int i;
>
> if (!priv->ntfy_blocks)
> @@ -518,29 +511,24 @@ static void gve_teardown_notify_blocks(struct gve_priv *priv)
> block->irq_requested = false;
> }
>
> - if (priv->mgmt_irq_requested) {
> - free_irq(priv->msix_vectors[priv->mgmt_msix_idx].vector, priv);
> - priv->mgmt_irq_requested = false;
> - }
> + ops->teardown_mgmt_irq(priv);
[Severity: High]
This isn't a bug introduced by this patch, but is it possible for the
management IRQ to fire after the workqueue is destroyed?
In gve_remove() in drivers/net/ethernet/google/gve/gve_main.c,
destroy_workqueue(priv->gve_wq) is called before gve_teardown_device(priv).
gve_teardown_device() eventually reaches this code to tear down the management
IRQ. Because the IRQ is still active and unmasked after destroy_workqueue(),
an interrupt could fire during this window.
If that happens, gve_mgmnt_intr() calls:
queue_work(priv->gve_wq, &priv->service_task);
Could this result in a use-after-free regression on the destroyed workqueue
pointer?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260602235900.3050782-1-hramamurthy@google.com?part=13
next prev parent reply other threads:[~2026-06-03 23:59 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-02 23:58 [PATCH net-next v2 00/15] gve: AdminQ mode related refactors Harshitha Ramamurthy
2026-06-02 23:58 ` [PATCH net-next v2 01/15] gve: don't pass in unused parameter to gve_adminq_free Harshitha Ramamurthy
2026-06-02 23:58 ` [PATCH net-next v2 02/15] gve: refactor initialization with helper functions Harshitha Ramamurthy
2026-06-03 23:59 ` sashiko-bot
2026-06-05 3:41 ` Harshitha Ramamurthy
2026-06-02 23:58 ` [PATCH net-next v2 03/15] gve: introduce gve_adminq_get_device_properties() Harshitha Ramamurthy
2026-06-02 23:58 ` [PATCH net-next v2 04/15] gve: add a few helper functions to set device properties Harshitha Ramamurthy
2026-06-02 23:58 ` [PATCH net-next v2 05/15] gve: add struct gve_device_info to hold " Harshitha Ramamurthy
2026-06-03 23:59 ` sashiko-bot
2026-06-05 3:44 ` Harshitha Ramamurthy
2026-06-02 23:58 ` [PATCH net-next v2 06/15] gve: introduce control plane operations structure Harshitha Ramamurthy
2026-06-02 23:58 ` [PATCH net-next v2 07/15] gve: introduce ctrl ops to set vectors and Qs Harshitha Ramamurthy
2026-06-02 23:58 ` [PATCH net-next v2 08/15] gve: refactor gve_init_priv for reset path Harshitha Ramamurthy
2026-06-03 23:59 ` sashiko-bot
2026-06-05 3:52 ` Harshitha Ramamurthy
2026-06-02 23:58 ` [PATCH net-next v2 09/15] gve: simplify reset logic Harshitha Ramamurthy
2026-06-03 23:59 ` sashiko-bot
2026-06-07 22:20 ` Joshua Washington
2026-06-02 23:58 ` [PATCH net-next v2 10/15] gve: add gve_ctrl_ops for gve initialization/teardown sequences Harshitha Ramamurthy
2026-06-02 23:58 ` [PATCH net-next v2 11/15] gve: split up notify block allocation and setup paths Harshitha Ramamurthy
2026-06-03 23:59 ` sashiko-bot
2026-06-07 22:29 ` Joshua Washington
2026-06-02 23:58 ` [PATCH net-next v2 12/15] gve: introduce new methods to handle IRQ doorbells Harshitha Ramamurthy
2026-06-03 23:59 ` sashiko-bot
2026-06-07 22:35 ` Joshua Washington
2026-06-02 23:58 ` [PATCH net-next v2 13/15] gve: setup and teardown management interrupts Harshitha Ramamurthy
2026-06-03 23:59 ` sashiko-bot [this message]
2026-06-07 22:39 ` Joshua Washington
2026-06-02 23:58 ` [PATCH net-next v2 14/15] gve: add ctrl ops to for queue operations Harshitha Ramamurthy
2026-06-05 3:56 ` Harshitha Ramamurthy
2026-06-02 23:58 ` [PATCH net-next v2 15/15] gve: add link status/speed ctrl ops Harshitha Ramamurthy
2026-06-03 23:59 ` sashiko-bot
2026-06-07 22:45 ` Joshua Washington
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=20260603235931.B038A1F00893@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.