From: sashiko-bot@kernel.org
To: "Zxyan Zhu" <zxyan0222@gmail.com>
Cc: linux-rt-devel@lists.linux.dev, bpf@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH net] net: stmmac: remove STMMAC_DOWN
Date: Wed, 02 Dec 2026 09:13:30 +0000 [thread overview]
Message-ID: <sashiko-outbox-245253@kernel.org> (raw)
In-Reply-To: <20261201091256.3000677-1-zxyan0222@gmail.com>
Thank you for your contribution! Sashiko AI review found no new issues
in this patch, but noticed 1 related pre-existing issue it does not
introduce:
- [Critical] net: stmmac: use-after-free in stmmac_xdp_xmit() [1]
--
commit b3472c0c67723fdc6361e7e9ee949e73296b5d41
Author: Zxyan Zhu <zxyan0222@gmail.com>
net: stmmac: remove STMMAC_DOWN
This commit removes the STMMAC_DOWN state flag so interrupt handlers can
continue clearing interrupt status during a reset, and replaces the
remaining checks in stmmac_xdp_xmit() and stmmac_xsk_wakeup() with
STMMAC_RESETING.
Link: https://lore.kernel.org/netdev/20240327110142.159851-1-cathy.cai@unisoc.com/
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> index a685ce4638f61..7f7be965604e0 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
[ ... ]
> @@ -7150,7 +7129,7 @@ static int stmmac_xdp_xmit(struct net_device *dev, int num_frames,
> int i, nxmit = 0;
> int queue;
>
> - if (unlikely(test_bit(STMMAC_DOWN, &priv->state)))
> + if (unlikely(test_bit(STMMAC_RESETING, &priv->state)))
> return -ENETDOWN;
>
> if (unlikely(flags & ~XDP_XMIT_FLAGS_MASK))
[Severity: Critical]
This problem wasn't introduced by this patch, but can stmmac_xdp_xmit() and
stmmac_xdp_xmit_back() hit a use-after-free and NULL pointer dereference
[1] when racing with XSK pool setup?
CPU0 CPU1
stmmac_xdp_enable_pool()
stmmac_disable_tx_queue()
netif_tx_stop_queue(txq)
__free_dma_tx_desc_resources()
kfree(tx_q->tx_skbuff_dma)
tx_q->dma_tx = NULL
stmmac_xdp_xmit()
__netif_tx_lock(nq, cpu)
stmmac_xdp_xmit_xdpf()
tx_q->tx_skbuff_dma[...] <-- UAF
stmmac_get_tx_desc() <-- NULL
stmmac_disable_tx_queue() stops the netdev TX queue and frees the queue's
DMA descriptor ring and tx_skbuff_dma array without setting
STMMAC_RESETING. Because stmmac_xdp_xmit() and stmmac_xdp_xmit_back() lock
the TX queue without checking netif_tx_queue_stopped(nq), a concurrent XDP
transmit proceeds into stmmac_xdp_xmit_xdpf() after the queue's descriptor
resources have been torn down.
[1] https://sashiko.dev/#/bug/linux-036a9552-9d2b-427c-9ba1-a4c73d79872e
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261201091256.3000677-1-zxyan0222@gmail.com?part=1
prev parent reply other threads:[~2026-12-02 9:13 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-01 9:12 [PATCH net] net: stmmac: remove STMMAC_DOWN Zxyan Zhu
2026-12-02 9:04 ` Maxime Chevallier
2026-12-02 9:13 ` 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=sashiko-outbox-245253@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rt-devel@lists.linux.dev \
--cc=sashiko-reviews@lists.linux.dev \
--cc=zxyan0222@gmail.com \
/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.