All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 4.19] dmaengine: at_hdmac: Fix memory leak
@ 2020-09-20  8:28 ` Pavel Machek
  0 siblings, 0 replies; 14+ messages in thread
From: Pavel Machek @ 2020-09-20  8:28 UTC (permalink / raw)
  To: linux-kernel, dmaengine, linux-arm-kernel, dan.j.williams, vkoul,
	ludovic.desroches, stable, Greg KH

[-- Attachment #1: Type: text/plain, Size: 793 bytes --]


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

Signed-off-by: Pavel Machek (CIP) <pavel@denx.de>

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

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

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

end of thread, other threads:[~2021-01-06 16:54 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-20  8:28 [PATCH 4.19] dmaengine: at_hdmac: Fix memory leak Pavel Machek
2020-09-20  8:28 ` Pavel Machek
2020-09-23  6:39 ` Ludovic Desroches
2020-09-23  6:39   ` Ludovic Desroches
2020-09-23  8:13 ` Tudor.Ambarus
2020-09-23  8:13   ` Tudor.Ambarus
2020-09-23  8:19   ` Tudor.Ambarus
2020-09-23  8:19     ` Tudor.Ambarus
2021-01-04 11:02     ` Greg KH
2021-01-04 11:02       ` Greg KH
2021-01-05  8:03       ` Tudor.Ambarus
2021-01-05  8:03         ` Tudor.Ambarus
2021-01-06 16:53         ` Greg KH
2021-01-06 16:53           ` Greg KH

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.