From: sashiko-bot@kernel.org
To: "Joshua Washington" <joshwash@google.com>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH net 6/6] gve: fix NULL dereference from premature XSK pool DMA unmap
Date: Sat, 15 Aug 2026 23:49:26 +0000 [thread overview]
Message-ID: <20260815234927.335531F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260814234845.773189-7-joshwash@google.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Kernel panic via NULL pointer dereference on XSK pool disable error path.
--
--- Patch [6]: [PATCH net 6/6] gve: fix NULL dereference from premature XSK pool DMA unmap ---
commit 70486a861c2e62f343665b0b44d80a866b2cbd87
Author: Joshua Washington <joshwash@google.com>
gve: fix NULL dereference from premature XSK pool DMA unmap
This commit defers the XSK pool DMA unmapping in gve_xsk_pool_disable()
until after the NAPI rings are disabled, aiming to prevent a race
condition that causes a NULL pointer dereference.
> 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
[ ... ]
> @@ -1681,28 +1681,24 @@ static int gve_xsk_pool_disable(struct net_device *dev,
> /* Stop and start RDA queues to repost buffers. */
> if (!gve_is_qpl(priv) && priv->xdp_prog) {
> err = gve_configure_rings_xdp(priv, priv->rx_cfg.num_queues);
> if (err)
> - return err;
> + goto unmap_and_return;
[Severity: High]
This is a pre-existing issue, but if gve_configure_rings_xdp() fails
(for example, due to a memory allocation failure), doesn't this goto bypass
the calls to napi_disable_locked() and gve_unreg_xsk_pool()?
[ ... ]
> - return 0;
> +unmap_and_return:
> + pool = xsk_get_pool_from_qid(dev, qid);
> + if (pool)
> + xsk_pool_dma_unmap(pool,
> + DMA_ATTR_SKIP_CPU_SYNC |
> + DMA_ATTR_WEAK_ORDERING);
> +
> + return err;
> }
[Severity: High]
If we reached this label via the gve_configure_rings_xdp() error path,
is it safe to call xsk_pool_dma_unmap() here?
Since the NAPI polling wasn't disabled and the active hardware ring's
xsk_pool pointer wasn't cleared, couldn't the still-active NAPI thread
dereference the unmapped pool->dev (which xsk_pool_dma_unmap() sets to
NULL) on the next packet, resulting in the exact same kernel panic this
patch is trying to prevent?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260814234845.773189-1-joshwash@google.com?part=6
next prev parent reply other threads:[~2026-08-15 23:49 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-14 23:48 [PATCH net 0/6] gve: various XDP fixes Joshua Washington
2026-08-14 23:48 ` [PATCH net 1/6] gve: increment work_done for XDP and error packets Joshua Washington
2026-08-15 23:49 ` sashiko-bot
2026-08-14 23:48 ` [PATCH net 2/6] gve: fix XSK buffer leak when rings are stopped Joshua Washington
2026-08-15 23:49 ` sashiko-bot
2026-08-14 23:48 ` [PATCH net 3/6] gve: fix XSK buffer leak on error descriptor Joshua Washington
2026-08-15 23:49 ` sashiko-bot
2026-08-14 23:48 ` [PATCH net 4/6] gve: don't register xsk pool on pre-existing queues in RDA mode Joshua Washington
2026-08-15 23:49 ` sashiko-bot
2026-08-14 23:48 ` [PATCH net 5/6] gve: fix napi_disable deadlock when attempting to disable XSK pools Joshua Washington
2026-08-15 23:49 ` sashiko-bot
2026-08-14 23:48 ` [PATCH net 6/6] gve: fix NULL dereference from premature XSK pool DMA unmap Joshua Washington
2026-08-15 23:49 ` sashiko-bot [this message]
2026-08-16 5:29 ` [PATCH net 0/6] gve: various XDP fixes 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=20260815234927.335531F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=joshwash@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.