From: sashiko-bot@kernel.org
To: "Karl Mehltretter" <kmehltretter@gmail.com>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH net 3/3] net: stmmac: stop DMA when IRQ registration fails
Date: Thu, 15 Oct 2026 06:27:31 +0000 [thread overview]
Message-ID: <sashiko-outbox-172342@kernel.org> (raw)
In-Reply-To: <2b70886410b5e9207ef170a48aca1d2d7ce24a68.1791958735.git.kmehltretter@gmail.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] net/stmmac: stmmac_xdp_set_prog() ignores stmmac_xdp_open() failure
- [Medium] net: stmmac: MAC Rx/Tx left enabled on open error paths
--
commit 7ffd7d4ee658f5d19fab03ed54e7532669eeea56
Author: Karl Mehltretter <kmehltretter@gmail.com>
net: stmmac: stop DMA when IRQ registration fails
Both __stmmac_open() and stmmac_xdp_open() start DMA before requesting
IRQs. If IRQ registration fails, their error paths release descriptors
and packet buffers while the DMA channels remain active.
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> index 8fd7d21730911..5c4df26a64bd6 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> @@ -4206,6 +4206,7 @@ static int __stmmac_open(struct net_device *dev,
> for (chan = 0; chan < priv->plat->tx_queues_to_use; chan++)
> hrtimer_cancel(&priv->dma_conf.tx_queue[chan].txtimer);
>
> + stmmac_stop_all_dma(priv);
[Severity: Medium]
In this error path, phylink_stop() is called just above this snippet, but it
only invokes the driver's mac_link_down callback if the link is considered
logically UP.
If the link was never UP, the MAC hardware is left active since it was
enabled earlier during stmmac_hw_setup().
Should the MAC be explicitly disabled here so it doesn't remain permanently
active?
> stmmac_release_ptp(priv);
> init_error:
> return ret;
> @@ -7259,6 +7260,7 @@ int stmmac_xdp_open(struct net_device *dev)
> irq_error:
> for (chan = 0; chan < priv->plat->tx_queues_to_use; chan++)
> hrtimer_cancel(&priv->dma_conf.tx_queue[chan].txtimer);
> + stmmac_stop_all_dma(priv);
[Severity: Medium]
Earlier in stmmac_xdp_open(), the MAC is explicitly enabled with
stmmac_mac_set(..., true).
However, this error cleanup path lacks the corresponding
stmmac_mac_set(..., false).
Will the MAC continue to process incoming packets and potentially overflow
the internal MTL FIFOs while the DMA and IRQs are stopped?
[Severity: High]
If we hit this error path, stmmac_xdp_open() cleans up its descriptors
and returns an error.
However, its caller stmmac_xdp_set_prog() ignores this return value:
drivers/net/ethernet/stmicro/stmmac/stmmac_xdp.c:stmmac_xdp_set_prog() {
...
if (if_running && need_update)
stmmac_xdp_open(dev);
if (prog)
xdp_features_set_redirect_target(dev, false);
return 0;
}
If an error occurs here, does this leave the interface functionally dead
while still reporting success to userspace?
>
> init_error:
> free_dma_desc_resources(priv, &priv->dma_conf);
--
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1791958735.git.kmehltretter@gmail.com?part=3
prev parent reply other threads:[~2026-10-15 6:27 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-14 6:26 [PATCH net 0/3] net: stmmac: fix DMA allocation and IRQ failure cleanup Karl Mehltretter
2026-10-14 6:26 ` [PATCH net 1/3] net: stmmac: handle partially allocated DMA queues Karl Mehltretter
2026-10-14 11:36 ` Maxime Chevallier
2026-10-14 6:27 ` [PATCH net 2/3] net: stmmac: free RX resources when TX allocation fails Karl Mehltretter
2026-10-14 11:37 ` Maxime Chevallier
2026-10-14 6:27 ` [PATCH net 3/3] net: stmmac: stop DMA when IRQ registration fails Karl Mehltretter
2026-10-14 11:29 ` Daniel Machon
2026-10-15 6:27 ` 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-172342@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=kmehltretter@gmail.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.