All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ata: sata_dwc_460ex: Fix DMA channel leak in sata_dwc_port_start()
@ 2026-11-17  9:49 Haoxiang Li
  2026-11-17  9:54 ` sashiko-bot
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Haoxiang Li @ 2026-11-17  9:49 UTC (permalink / raw)
  To: dlemoal, cassel, mans, tj; +Cc: linux-ide, linux-kernel, Haoxiang Li

If phy_power_on() fails in sata_dwc_port_start(), the error path
frees hsdevp without releasing the DMA channel acquired earlier.
Add a cleanup label to release the DMA channel before freeing
hsdevp on this failure path.

Fixes: 0f48debdb906 ("ata: sata_dwc_460ex: add phy support")
Signed-off-by: Haoxiang Li <haoxiang_li2024@163.com>
---
 drivers/ata/sata_dwc_460ex.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/ata/sata_dwc_460ex.c b/drivers/ata/sata_dwc_460ex.c
index 486ea94a0184..c1025ab3e474 100644
--- a/drivers/ata/sata_dwc_460ex.c
+++ b/drivers/ata/sata_dwc_460ex.c
@@ -853,7 +853,7 @@ static int sata_dwc_port_start(struct ata_port *ap)
 
 	err = phy_power_on(hsdev->phy);
 	if (err)
-		goto CLEANUP_ALLOC;
+		goto CLEANUP_DMA;
 
 	for (i = 0; i < SATA_DWC_QCMD_MAX; i++)
 		hsdevp->cmd_issued[i] = SATA_DWC_CMD_ISSUED_NOT;
@@ -880,6 +880,8 @@ static int sata_dwc_port_start(struct ata_port *ap)
 	dev_dbg(ap->dev, "%s: done\n", __func__);
 	return 0;
 
+CLEANUP_DMA:
+	dma_release_channel(hsdevp->chan);
 CLEANUP_ALLOC:
 	kfree(hsdevp);
 CLEANUP:
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-11-17 12:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-17  9:49 [PATCH] ata: sata_dwc_460ex: Fix DMA channel leak in sata_dwc_port_start() Haoxiang Li
2026-11-17  9:54 ` sashiko-bot
2026-11-17 12:05 ` Damien Le Moal
2026-11-17 12:38 ` Niklas Cassel

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.