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 v5 09/12] gve: introduce new methods to handle IRQ doorbells
Date: Fri, 04 Sep 2026 21:56:33 +0000	[thread overview]
Message-ID: <20260904215633.8A5E31F00AC4@smtp.kernel.org> (raw)
In-Reply-To: <20260903215606.31633-10-hramamurthy@google.com>

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

Pre-existing issues:
- [High] Missing cancellation of stats_report_task leads to NULL pointer dereference on stats_report
--

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

gve: introduce new methods to handle IRQ doorbells

This commit introduces request_db_info and release_db_resources to
struct gve_ctrl_ops. It encapsulates the configuration of device resources
such as counter arrays and IRQ doorbell indices.

> diff --git a/drivers/net/ethernet/google/gve/gve_main.c b/drivers/net/ethernet/google/gve/gve_main.c
> index 619ef46a7b30a..a160d36f718b9 100644
> --- a/drivers/net/ethernet/google/gve/gve_main.c
> +++ b/drivers/net/ethernet/google/gve/gve_main.c

[ ... ]

> @@ -602,7 +606,6 @@ static int gve_setup_notify_blocks(struct gve_priv *priv)
>  	return err;
>  }
>  
> -
>  static void gve_free_control_plane_resources(struct gve_priv *priv)
>  {
>  	bitmap_free(priv->xsk_pools);
> @@ -611,9 +614,10 @@ static void gve_free_control_plane_resources(struct gve_priv *priv)
>  	kvfree(priv->ptype_lut_dqo);
>  	priv->ptype_lut_dqo = NULL;
>  
> -	gve_free_stats_report(priv);
> -	gve_free_notify_blocks(priv);
> +	gve_free_irq_db_indices(priv);
>  	gve_free_counter_array(priv);
> +	gve_free_notify_blocks(priv);
> +	gve_free_stats_report(priv);

[Severity: High]
This isn't a bug introduced by this patch, but could this lead to a NULL
pointer dereference when the uncancelled work item executes?

Looking at gve_free_stats_report(), it stops the timer and frees the
priv->stats_report memory, but it does not cancel the stats_report_task
work item.

If the network interface is down but the report-stats feature is enabled via
ethtool, gve_queues_stop() is never called during device removal or
suspend. This means the work item remains pending because the only
cancel_work_sync() for this task happens in gve_queues_stop().

When the device is later removed or suspended, the workqueue is flushed
(or executes concurrently), which allows gve_stats_report_task() to run
after the memory is freed. This eventually calls into
gve_handle_report_stats(), which dereferences the NULL pointer:

drivers/net/ethernet/google/gve/gve_main.c:gve_handle_report_stats() {
	struct stats *stats = priv->stats_report->stats;
	...
}

Should a call to cancel_work_sync(&priv->stats_report_task) be added to
gve_free_stats_report() to ensure the work item cannot execute after the
underlying memory is destroyed?

>  	gve_free_rss_config_cache(priv);
>  	gve_free_flow_rule_caches(priv);
>  }

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

  reply	other threads:[~2026-09-04 21:56 UTC|newest]

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