From: Wentao Liang <vulab@iscas.ac.cn>
To: Daniel Machon <daniel.machon@microchip.com>,
UNGLinuxDriver@microchip.com, Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Steen Hegelund <Steen.Hegelund@microchip.com>
Cc: netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, Wentao Liang <vulab@iscas.ac.cn>,
stable@vger.kernel.org
Subject: [PATCH] net: lan969x: fix page pool leak when RX DMA allocation fails
Date: Tue, 3 Nov 2026 10:28:54 +0000 [thread overview]
Message-ID: <20261103102854.1340615-1-vulab@iscas.ac.cn> (raw)
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
next reply other threads:[~2026-11-03 10:28 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-03 10:28 Wentao Liang [this message]
2026-11-03 10:34 ` netdev-bot+sinfo
2026-11-03 12:26 ` 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=20261103102854.1340615-1-vulab@iscas.ac.cn \
--to=vulab@iscas.ac.cn \
--cc=Steen.Hegelund@microchip.com \
--cc=UNGLinuxDriver@microchip.com \
--cc=andrew+netdev@lunn.ch \
--cc=daniel.machon@microchip.com \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=stable@vger.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
all inboxes | Powered by JetHome®