From: Maxime Chevallier <maxime.chevallier@bootlin.com>
To: Karl Mehltretter <kmehltretter@gmail.com>,
Andrew Lunn <andrew+netdev@lunn.ch>,
netdev@vger.kernel.org
Cc: "David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Maxime Coquelin <mcoquelin.stm32@gmail.com>,
Alexandre Torgue <alexandre.torgue@foss.st.com>,
Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Jesper Dangaard Brouer <hawk@kernel.org>,
John Fastabend <john.fastabend@gmail.com>,
Stanislav Fomichev <sdf@fomichev.me>,
Joao Pinto <Joao.Pinto@synopsys.com>,
Giuseppe Cavallaro <peppe.cavallaro@st.com>,
Srinivas Kandagatla <srini@kernel.org>,
Ong Boon Leong <boon.leong.ong@intel.com>,
bpf@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH net 2/3] net: stmmac: free RX resources when TX allocation fails
Date: Wed, 14 Oct 2026 13:37:19 +0200 [thread overview]
Message-ID: <1e6bee3e-a4fd-4cdb-9c42-5cee57e3ed83@bootlin.com> (raw)
In-Reply-To: <e7a5380aabfbc03bd560ab08f37ea255d11d528a.1791958735.git.kmehltretter@gmail.com>
Hi,
On 10/14/26 08:27, Karl Mehltretter wrote:
> alloc_dma_desc_resources() allocates every RX queue before allocating
> TX queues. If TX allocation fails, its error path only frees TX
> resources and leaks all RX resources.
>
> Free the RX resources after the TX allocator unwinds its queues.
>
> Found by inspection. On a BeagleV Ahead (TH1520), forcing TX DMA
> metadata allocation to fail left the RX cleanup event absent. With this
> change, both TX and RX resources were released.
>
> Fixes: 71fedb0198cb ("net: stmmac: break some functions into RX and TX scopes")
> Assisted-by: LLM
> Signed-off-by: Karl Mehltretter <kmehltretter@gmail.com>
Also covered by https://lore.kernel.org/netdev/20261012142458.2845385-1-dinghui1111@163.com/.
Thanks,
Maxime
> ---
> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> index 495ff7aef..8fd7d2173 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> @@ -2425,6 +2425,8 @@ static int alloc_dma_desc_resources(struct stmmac_priv *priv,
> return ret;
>
> ret = alloc_dma_tx_desc_resources(priv, dma_conf);
> + if (ret)
> + free_dma_rx_desc_resources(priv, dma_conf);
>
> return ret;
> }
next prev parent reply other threads:[~2026-10-14 11:37 UTC|newest]
Thread overview: 7+ 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 [this message]
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
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=1e6bee3e-a4fd-4cdb-9c42-5cee57e3ed83@bootlin.com \
--to=maxime.chevallier@bootlin.com \
--cc=Joao.Pinto@synopsys.com \
--cc=alexandre.torgue@foss.st.com \
--cc=andrew+netdev@lunn.ch \
--cc=ast@kernel.org \
--cc=boon.leong.ong@intel.com \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=hawk@kernel.org \
--cc=john.fastabend@gmail.com \
--cc=kmehltretter@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=mcoquelin.stm32@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=peppe.cavallaro@st.com \
--cc=sdf@fomichev.me \
--cc=srini@kernel.org \
/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