Skip to contentSkip to conversation

net: wwan: t7xx: destroy DMA pool on CLDMA late init failure

PATCH Applied Haoxiang Li 3 participants 3 messages Jun 21 – Jun 25

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: wwan: t7xx: destroy DMA pool on CLDMA late init failure

t7xx_cldma_late_init() creates md_ctrl->gpd_dmapool before initializing the TX and RX rings. If any ring initialization fails, the error path frees the already initialized rings but leaves the DMA pool allocated.

Destroy md_ctrl->gpd_dmapool on the late-init failure path to avoid leaking the DMA pool.

Fixes 39d439047f1d ("net: wwan: t7xx: Add control DMA interface")
---
 drivers/net/wwan/t7xx/t7xx_hif_cldma.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/net/wwan/t7xx/t7xx_hif_cldma.c +3 -0
index e10cb4f9104e..2917cee9b802 100644
@@ -1063,6 +1063,9 @@ static int t7xx_cldma_late_init(struct cldma_ctrl *md_ctrl)
 	while (i--)
 		t7xx_cldma_ring_free(md_ctrl, &md_ctrl->tx_ring[i], DMA_TO_DEVICE);
 
+	dma_pool_destroy(md_ctrl->gpd_dmapool);
+	md_ctrl->gpd_dmapool = NULL;
+
 	return ret;
 }
 
Signature · 1 line
2.25.1
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Haoxiang Li

t7xx_cldma_late_init() creates md_ctrl->gpd_dmapool before initializing the TX and RX rings. If any ring initialization fails, the error path frees the already initialized rings but leaves the DMA pool allocated.

Quoted 6 lines

Destroy md_ctrl->gpd_dmapool on the late-init failure path to avoid leaking the DMA pool.

Fixes 39d439047f1d ("net: wwan: t7xx: Add control DMA interface")
Quoted 21 lines
---
 drivers/net/wwan/t7xx/t7xx_hif_cldma.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/net/wwan/t7xx/t7xx_hif_cldma.c +3 -1
index e10cb4f9104e..2917cee9b802 100644
@@ -1063,6 +1063,9 @@ static int t7xx_cldma_late_init(struct cldma_ctrl *md_ctrl)
        while (i--)
                t7xx_cldma_ring_free(md_ctrl, &md_ctrl->tx_ring[i], DMA_TO_DEVICE);
 
+       dma_pool_destroy(md_ctrl->gpd_dmapool);
+       md_ctrl->gpd_dmapool = NULL;
+
        return ret;
 }
 
--

2.25.1

#2 lore raw
In reply to Haoxiang Li
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:

Quoted 9 lines · On Sun, 21 Jun 2026 11:17:14 +0800 you wrote:

t7xx_cldma_late_init() creates md_ctrl->gpd_dmapool before initializing the TX and RX rings. If any ring initialization fails, the error path frees the already initialized rings but leaves the DMA pool allocated.

Destroy md_ctrl->gpd_dmapool on the late-init failure path to avoid leaking the DMA pool.

[...]

Here is the summary with links:
- net: wwan: t7xx: destroy DMA pool on CLDMA late init failure

    https://git.kernel.org/netdev/net/c/2bd6f26d4ce1

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html