* [PATCH] net: lan969x: fix page pool leak when RX DMA allocation fails
@ 2026-11-03 10:28 Wentao Liang
2026-11-03 10:34 ` netdev-bot+sinfo
2026-11-03 12:26 ` Daniel Machon
0 siblings, 2 replies; 3+ messages in thread
From: Wentao Liang @ 2026-11-03 10:28 UTC (permalink / raw)
To: Daniel Machon, UNGLinuxDriver, Andrew Lunn, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Steen Hegelund
Cc: netdev, linux-arm-kernel, linux-kernel, Wentao Liang, stable
lan969x_fdma_rx_alloc() creates the RX page pool and then allocates the
FDMA coherent memory. If fdma_alloc_coherent() fails, the function
returns without destroying the page pool.
The failure propagates out of lan969x_fdma_init(), and
sparx5_frame_io_init() then marks the FDMA IRQ as unavailable, so
lan969x_fdma_deinit() is never called on teardown and the page pool is
never released. Destroy it before returning the error.
Fixes: d84ad2c0d80c ("net: lan969x: add FDMA implementation")
Cc: stable@vger.kernel.org
Assisted-by: DeepSeek-V4.1-Flash and OpenAI Codex
Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
---
drivers/net/ethernet/microchip/sparx5/lan969x/lan969x_fdma.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/microchip/sparx5/lan969x/lan969x_fdma.c b/drivers/net/ethernet/microchip/sparx5/lan969x/lan969x_fdma.c
index 053d125eda65..bc293ba1707d 100644
--- a/drivers/net/ethernet/microchip/sparx5/lan969x/lan969x_fdma.c
+++ b/drivers/net/ethernet/microchip/sparx5/lan969x/lan969x_fdma.c
@@ -169,8 +169,10 @@ static int lan969x_fdma_rx_alloc(struct sparx5 *sparx5)
return PTR_ERR(rx->page_pool);
err = fdma_alloc_coherent(sparx5->dev, fdma);
- if (err)
+ if (err) {
+ page_pool_destroy(rx->page_pool);
return err;
+ }
fdma_dcbs_init(fdma,
FDMA_DCB_INFO_DATAL(fdma->db_size),
--
2.34.1
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] net: lan969x: fix page pool leak when RX DMA allocation fails
2026-11-03 10:28 [PATCH] net: lan969x: fix page pool leak when RX DMA allocation fails Wentao Liang
@ 2026-11-03 10:34 ` netdev-bot+sinfo
2026-11-03 12:26 ` Daniel Machon
1 sibling, 0 replies; 3+ messages in thread
From: netdev-bot+sinfo @ 2026-11-03 10:34 UTC (permalink / raw)
To: Wentao Liang
Cc: Daniel Machon, UNGLinuxDriver, Andrew Lunn, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Steen Hegelund,
netdev, linux-arm-kernel, linux-kernel, stable
Hi!
This is an automated message. This series looks like a fix, but its
commit messages seem to be missing some information:
- How the issue was discovered, e.g. hit in production, hit during
development, syzbot report, manual code inspection, LLM or static
analysis tool scan.
- Whether the issue was actually triggered, or is only theoretical
(e.g. found by code inspection). If it was triggered please include
the symptoms, like the stack trace or error messages.
- What hardware the change was tested on. For driver fixes please
mention the device (and if relevant firmware version) used for
testing, or say that the change was not tested on real hardware.
Please do not repost the series just to address the above. Instead,
reply to this email with the missing information, so that reviewers
can take it into account. If the series needs another revision for
other reasons, please include the information in the commit messages
then.
The evaluation is done by an LLM so it may be wrong, if you think
that is the case please reply and explain.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] net: lan969x: fix page pool leak when RX DMA allocation fails
2026-11-03 10:28 [PATCH] net: lan969x: fix page pool leak when RX DMA allocation fails Wentao Liang
2026-11-03 10:34 ` netdev-bot+sinfo
@ 2026-11-03 12:26 ` Daniel Machon
1 sibling, 0 replies; 3+ messages in thread
From: Daniel Machon @ 2026-11-03 12:26 UTC (permalink / raw)
To: Wentao Liang
Cc: UNGLinuxDriver, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Steen Hegelund, netdev,
linux-arm-kernel, linux-kernel, stable
Hi Wentao,
> lan969x_fdma_rx_alloc() creates the RX page pool and then allocates the
> FDMA coherent memory. If fdma_alloc_coherent() fails, the function
> returns without destroying the page pool.
>
> The failure propagates out of lan969x_fdma_init(), and
> sparx5_frame_io_init() then marks the FDMA IRQ as unavailable, so
> lan969x_fdma_deinit() is never called on teardown and the page pool is
> never released. Destroy it before returning the error.
>
> Fixes: d84ad2c0d80c ("net: lan969x: add FDMA implementation")
> Cc: stable@vger.kernel.org
> Assisted-by: DeepSeek-V4.1-Flash and OpenAI Codex
> Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
> ---
> drivers/net/ethernet/microchip/sparx5/lan969x/lan969x_fdma.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/microchip/sparx5/lan969x/lan969x_fdma.c b/drivers/net/ethernet/microchip/sparx5/lan969x/lan969x_fdma.c
> index 053d125eda65..bc293ba1707d 100644
> --- a/drivers/net/ethernet/microchip/sparx5/lan969x/lan969x_fdma.c
> +++ b/drivers/net/ethernet/microchip/sparx5/lan969x/lan969x_fdma.c
> @@ -169,8 +169,10 @@ static int lan969x_fdma_rx_alloc(struct sparx5 *sparx5)
> return PTR_ERR(rx->page_pool);
>
> err = fdma_alloc_coherent(sparx5->dev, fdma);
> - if (err)
> + if (err) {
> + page_pool_destroy(rx->page_pool);
> return err;
> + }
>
> fdma_dcbs_init(fdma,
> FDMA_DCB_INFO_DATAL(fdma->db_size),
> --
> 2.34.1
>
Thanks. The leak is real, but this init path has another problem
of the same kind:
- If lan969x_fdma_tx_alloc() fails, lan969x_fdma_init() only frees
the RX coherent memory. The page pool and the RX pages that
fdma_dcbs_init() already took from it are leaked, for the same
reason you describe.
All of this has been there since the FDMA implementation was added, and only
triggers on allocation failures at probe. I have a net-next series for
MTU-dependent RX buffer sizes coming up (very soon, within days) that reworks
this exact code and its error unwind, so I'll fix this (and other related
issues) there.
I'd suggest dropping this one.
pw-bot: rejected
/Daniel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-11-03 12:26 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-03 10:28 [PATCH] net: lan969x: fix page pool leak when RX DMA allocation fails Wentao Liang
2026-11-03 10:34 ` netdev-bot+sinfo
2026-11-03 12:26 ` Daniel Machon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®