From: sashiko-bot@kernel.org
To: "Harshitha Ramamurthy" <hramamurthy@google.com>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH net-next v3 15/15] gve: add link status/speed ctrl ops
Date: Tue, 04 Aug 2026 18:47:05 +0000 [thread overview]
Message-ID: <20260804184706.3A4031F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260803184630.3813311-16-hramamurthy@google.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
Pre-existing issues:
- [High] Ethtool operations can trigger a Use-After-Free on the admin queue memory if the device fails a reset or is torn down.
- [High] Temporary DMA buffer is freed on command timeout without canceling the hardware operation, leading to potential DMA-after-free memory corruption.
--
--- Patch [15]: [PATCH net-next v3 15/15] gve: add link status/speed ctrl ops ---
commit 4e6d0e28f03e61bed3005f52fb8ced4997d772eb
Author: Joshua Washington <joshwash@google.com>
gve: add link status/speed ctrl ops
Refactor link status check to use a control plane op. Introduce
new op for retrieving the link status in AQ mode, and add an op
for retrieving link speed which calls into gve_adminq_report_link_speed.
> diff --git a/drivers/net/ethernet/google/gve/gve_ethtool.c b/drivers/net/ethernet/google/gve/gve_ethtool.c
> --- a/drivers/net/ethernet/google/gve/gve_ethtool.c
> +++ b/drivers/net/ethernet/google/gve/gve_ethtool.c
> @@ -749,12 +749,11 @@ static int gve_get_link_ksettings(struct net_device *netdev,
> int err = 0;
>
> if (priv->link_speed == 0)
> - err = gve_adminq_report_link_speed(priv);
> + err = priv->ctrl_ops->report_link_speed(priv);
[Severity: High]
This isn't a bug introduced by this patch, but I wanted to ask about the
lifecycle of the admin queue here.
When the device is suspended or fails a reset, gve_teardown_device()
is called, which invokes gve_adminq_free(). This frees priv->adminq and
destroys the DMA pool, but leaves the priv->adminq pointer dangling.
If ethtool triggers gve_get_link_ksettings() while the device is in this
state, we unconditionally call report_link_speed(). This results in:
gve_get_link_ksettings()
priv->ctrl_ops->report_link_speed() (gve_adminq_report_link_speed)
gve_adminq_execute_cmd()
gve_adminq_issue_cmd()
In gve_adminq_issue_cmd(), the freed priv->adminq buffer is accessed and
written to without checking gve_get_admin_queue_ok().
Can this lead to a use-after-free if ethtool accesses the link settings
during a failed reset or after device teardown?
[Severity: High]
This is also a pre-existing issue, but while looking at
gve_adminq_report_link_speed() being called here, I noticed a potential
DMA-after-free.
In gve_adminq_report_link_speed(), a temporary buffer is allocated via
dma_alloc_coherent() and its bus address is passed to the NIC. If
gve_adminq_execute_cmd() times out (for example, if
gve_adminq_kick_and_wait() returns -ENOTRECOVERABLE), the function
immediately calls dma_free_coherent() on the error path to free the region.
Since the hardware is not reset or instructed to abort the command before
the memory is freed, what happens if the hardware later wakes up and
executes the delayed command?
Will it DMA the 8-byte link speed into the freed memory, potentially
corrupting whatever structure now occupies that address?
> cmd->base.speed = priv->link_speed;
>
> cmd->base.duplex = DUPLEX_FULL;
> -
> return err;
> }
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260803184630.3813311-1-hramamurthy@google.com?part=15
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
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 [this message]
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=20260804184706.3A4031F00A3A@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