mirror of https://lore.kernel.org/lkml/
 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 12:05 ` Damien Le Moal
  2026-11-17 12:38 ` Niklas Cassel
  0 siblings, 2 replies; 3+ 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	[flat|nested] 3+ messages in thread

* Re: [PATCH] ata: sata_dwc_460ex: Fix DMA channel leak in sata_dwc_port_start()
  2026-11-17  9:49 [PATCH] ata: sata_dwc_460ex: Fix DMA channel leak in sata_dwc_port_start() Haoxiang Li
@ 2026-11-17 12:05 ` Damien Le Moal
  2026-11-17 12:38 ` Niklas Cassel
  1 sibling, 0 replies; 3+ messages in thread
From: Damien Le Moal @ 2026-11-17 12:05 UTC (permalink / raw)
  To: Haoxiang Li, cassel, mans, tj; +Cc: linux-ide, linux-kernel

On 11/17/26 01:49, Haoxiang Li wrote:
> 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>

Looks good.

Reviewed-by: Damien Le Moal <dlemoal@kernel.org>


-- 
Damien Le Moal
Western Digital Research

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

* Re: [PATCH] ata: sata_dwc_460ex: Fix DMA channel leak in sata_dwc_port_start()
  2026-11-17  9:49 [PATCH] ata: sata_dwc_460ex: Fix DMA channel leak in sata_dwc_port_start() Haoxiang Li
  2026-11-17 12:05 ` Damien Le Moal
@ 2026-11-17 12:38 ` Niklas Cassel
  1 sibling, 0 replies; 3+ messages in thread
From: Niklas Cassel @ 2026-11-17 12:38 UTC (permalink / raw)
  To: dlemoal, mans, tj, Haoxiang Li; +Cc: linux-ide, linux-kernel

On Tue, 17 Nov 2026 17:49:03 +0800, Haoxiang Li wrote:
> 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.
> 
> 

Applied to libata/linux.git (for-7.5), thanks!

[1/1] ata: sata_dwc_460ex: Fix DMA channel leak in sata_dwc_port_start()
      https://git.kernel.org/libata/linux/c/9397e8e9

Kind regards,
Niklas


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

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

Thread overview: 3+ 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 12:05 ` Damien Le Moal
2026-11-17 12:38 ` Niklas Cassel

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®