Thread (7 messages) 7 messages, 4 authors, 2021-01-06

Re: [PATCH 4.19] dmaengine: at_hdmac: Fix memory leak

From: Ludovic Desroches <ludovic.desroches@microchip.com>
Date: 2020-09-23 06:39:42
Also in: dmaengine, lkml, stable

On Sun, Sep 20, 2020 at 10:28:38AM +0200, Pavel Machek wrote:
Date: Sun, 20 Sep 2020 10:28:38 +0200
From: Pavel Machek <redacted>
To: linux-kernel@vger.kernel.org, dmaengine@vger.kernel.org,
 linux-arm-kernel@lists.infradead.org, dan.j.williams@intel.com,
 vkoul@kernel.org, ludovic.desroches@microchip.com, stable@vger.kernel.org,
 Greg KH [off-list ref]
Subject: [PATCH 4.19] dmaengine: at_hdmac: Fix memory leak


This fixes memory leak in at_hdmac. Mainline does not have the same
problem.

Signed-off-by: Pavel Machek (CIP) <redacted>
Acked-by: Ludovic Desroches <ludovic.desroches@microchip.com>

Thanks.
quoted hunk ↗ jump to hunk
diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
index 86427f6ba78c..0847b2055857 100644
--- a/drivers/dma/at_hdmac.c
+++ b/drivers/dma/at_hdmac.c
@@ -1714,8 +1714,10 @@ static struct dma_chan *at_dma_xlate(struct of_phandle_args *dma_spec,
 	atslave->dma_dev = &dmac_pdev->dev;
 
 	chan = dma_request_channel(mask, at_dma_filter, atslave);
-	if (!chan)
+	if (!chan) {
+		kfree(atslave);
 		return NULL;
+	}
 
 	atchan = to_at_dma_chan(chan);
 	atchan->per_if = dma_spec->args[0] & 0xff;
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html



_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help