BPF List
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Harshitha Ramamurthy" <hramamurthy@google.com>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH net-next v6 08/12] gve: split up notify block allocation and setup paths
Date: Thu, 10 Sep 2026 19:11:57 +0000	[thread overview]
Message-ID: <20260910191157.BCC421F00893@smtp.kernel.org> (raw)
In-Reply-To: <20260909191136.3811892-9-hramamurthy@google.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] Missing cancel_work_sync() for stats_report_task leads to NULL Pointer Dereference during device teardown.
--

commit c59c716d20178f6c3e44afb298f8d5eeb8f487be
Author: Joshua Washington <joshwash@google.com>

    gve: split up notify block allocation and setup paths
    
    Before this patch, notify block allocation and setup occurred in the same
    method. This all occurred before gve_adminq_configure_device_resources,
    which populates the irq_db_indicies array, a DMA region with BAR offsets
    for MSI-X vectors.

> diff --git a/drivers/net/ethernet/google/gve/gve_main.c b/drivers/net/ethernet/google/gve/gve_main.c
> index cc27141240fd1..d2f974a0cc877 100644
> --- a/drivers/net/ethernet/google/gve/gve_main.c
> +++ b/drivers/net/ethernet/google/gve/gve_main.c

[ ... ]

> @@ -749,6 +758,7 @@ static void gve_teardown_control_plane_resources(struct gve_priv *priv)
>  
>  static void gve_teardown_device(struct gve_priv *priv)
>  {
> +	gve_teardown_notify_blocks(priv);
>  	gve_teardown_control_plane_resources(priv);

[Severity: High]
This is a pre-existing issue, but does the device teardown path properly
cancel the stats_report_task?

If a user enables stats reporting while the interface is down,
stats_report_timer is armed and enqueues stats_report_task into the
workqueue. If the device is subsequently unbound, gve_teardown_device()
calls gve_teardown_control_plane_resources(), which eventually calls
gve_free_stats_report().

In drivers/net/ethernet/google/gve/gve_main.c:gve_free_stats_report():

	timer_delete_sync(&priv->stats_report_timer);
	dma_free_coherent(&priv->pdev->dev, priv->stats_report_len,
			  priv->stats_report, priv->stats_report_bus);
	priv->stats_report = NULL;

This deletes the timer and frees the memory, but leaves the pending task in
the workqueue.

Then gve_remove() continues and flushes the workqueue:

	gve_teardown_device(priv);
	destroy_workqueue(priv->gve_wq);

When the workqueue is flushed, stats_report_task will execute
gve_handle_report_stats(), which dereferences priv->stats_report:

void gve_handle_report_stats(struct gve_priv *priv)
{
	struct stats *stats = priv->stats_report->stats;

Could this lead to a NULL pointer dereference? Should cancel_work_sync() be
called on stats_report_task before freeing priv->stats_report?

>  	gve_adminq_free(priv);
>  	/*

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260909191136.3811892-1-hramamurthy@google.com?part=8

  reply	other threads:[~2026-09-10 19:11 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-09 19:11 [PATCH net-next v6 00/12] gve: AdminQ mode related refactors Harshitha Ramamurthy
2026-09-09 19:11 ` [PATCH net-next v6 01/12] gve: add struct gve_device_info to hold device properties Harshitha Ramamurthy
2026-09-10 19:11   ` sashiko-bot
2026-09-10 22:13   ` netdev-bot+sashiko
2026-09-11  0:23     ` Harshitha Ramamurthy
2026-09-09 19:11 ` [PATCH net-next v6 02/12] gve: introduce control plane operations structure Harshitha Ramamurthy
2026-09-09 19:11 ` [PATCH net-next v6 03/12] gve: introduce ctrl ops to set vectors and Qs Harshitha Ramamurthy
2026-09-09 19:11 ` [PATCH net-next v6 04/12] gve: introduce gve_adminq_get_device_properties() Harshitha Ramamurthy
2026-09-10 22:13   ` netdev-bot+sashiko
2026-09-11  0:58     ` Harshitha Ramamurthy
2026-09-09 19:11 ` [PATCH net-next v6 05/12] gve: refactor gve_init_priv for reset path Harshitha Ramamurthy
2026-09-10 22:13   ` netdev-bot+sashiko
2026-09-11  1:06     ` Harshitha Ramamurthy
2026-09-09 19:11 ` [PATCH net-next v6 06/12] gve: simplify reset logic Harshitha Ramamurthy
2026-09-10 19:11   ` sashiko-bot
2026-09-10 22:13   ` netdev-bot+sashiko
2026-09-11 20:31     ` Joshua Washington
2026-09-09 19:11 ` [PATCH net-next v6 07/12] gve: add gve_ctrl_ops for gve initialization/teardown sequences Harshitha Ramamurthy
2026-09-09 19:11 ` [PATCH net-next v6 08/12] gve: split up notify block allocation and setup paths Harshitha Ramamurthy
2026-09-10 19:11   ` sashiko-bot [this message]
2026-09-09 19:11 ` [PATCH net-next v6 09/12] gve: introduce new methods to handle IRQ doorbells Harshitha Ramamurthy
2026-09-10 22:13   ` netdev-bot+sashiko
2026-09-09 19:11 ` [PATCH net-next v6 10/12] gve: setup and teardown management interrupts Harshitha Ramamurthy
2026-09-09 19:11 ` [PATCH net-next v6 11/12] gve: add ctrl ops for queue operations Harshitha Ramamurthy
2026-09-09 19:11 ` [PATCH net-next v6 12/12] gve: add link status/speed ctrl ops Harshitha Ramamurthy
2026-09-10 19:11   ` 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=20260910191157.BCC421F00893@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