All of lore.kernel.org
 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 v4 05/15] gve: introduce control plane operations structure
Date: Sat, 15 Aug 2026 02:14:38 +0000	[thread overview]
Message-ID: <20260815021438.EFF7D1F00A3D@smtp.kernel.org> (raw)
In-Reply-To: <20260814021406.3044324-6-hramamurthy@google.com>

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

Pre-existing issues:
- [High] Workqueue flushed after private resources are freed, leading to memory leaks and Use-After-Free.
--

--- Patch [5]: [PATCH net-next v4 05/15] gve: introduce control plane operations structure ---
commit 21d462ce52db670852717f6c821149b6dd730ea9
Author: Harshitha Ramamurthy <hramamurthy@google.com>

gve: introduce control plane operations structure

To abstract out the difference in implementation of control plane operations
between the existing Adminq ABI and the upcoming Mailbox ABI, introduce a new
gve_ctrl_ops structure which will contain the basic operations.

> 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
[ ... ]
> @@ -3000,14 +3005,13 @@ static void gve_remove(struct pci_dev *pdev)
>  {
>  	struct net_device *netdev = pci_get_drvdata(pdev);
>  	struct gve_priv *priv = netdev_priv(netdev);
> -	__be32 __iomem *db_bar = priv->db_bar2;
>  	void __iomem *reg_bar = priv->reg_bar0;
>  
>  	unregister_netdev(netdev);
>  	gve_teardown_priv_resources(priv);
>  	destroy_workqueue(priv->gve_wq);
> +	priv->ctrl_ops->unmap_db_bar(priv);
>  	free_netdev(netdev);
> -	pci_iounmap(pdev, db_bar);
>  	pci_iounmap(pdev, reg_bar);
>  	pci_release_regions(pdev);
>  	pci_disable_device(pdev);

[Severity: High]
This is a pre-existing issue, but is it possible that tearing down private
resources before destroying the workqueue causes memory leaks and a use
after free?

If a service task is pending during gve_remove() and a reset was requested
via management IRQ, destroy_workqueue() will flush and execute it. 

The service task executes gve_reset() which can re-allocate resources and
re-register MSI-X interrupts.

Since gve_teardown_priv_resources() has already run, these newly allocated
resources won't be torn down before free_netdev() frees the priv pointer.

If the active MSI-X interrupt fires afterwards, would the interrupt handler
end up accessing the freed priv pointer?

It looks like this same ordering issue also exists in the probe error
handling path.

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

  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
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 [this message]
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=20260815021438.EFF7D1F00A3D@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.