diff mbox

[3/5] dmaengine: bcm2835-dma: Fix memory leak when stopping a running transfer

Message ID 1427456155-28990-4-git-send-email-peter.ujfalusi@ti.com (mailing list archive)
State Accepted
Headers show

Commit Message

Peter Ujfalusi March 27, 2015, 11:35 a.m. UTC
The vd->node is removed from the lists when the transfer started so the
vchan_get_all_descriptors() will not find it. This results memory leak.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
CC: Stephen Warren <swarren@wwwdotorg.org>
CC: Lee Jones <lee@kernel.org>
---
 drivers/dma/bcm2835-dma.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Stephen Warren March 28, 2015, 3:57 a.m. UTC | #1
On 03/27/2015 05:35 AM, Peter Ujfalusi wrote:
> The vd->node is removed from the lists when the transfer started so the
> vchan_get_all_descriptors() will not find it. This results memory leak.

Acked-by: Stephen Warren <swarren@wwwdotorg.org>
(I'm just assuming the explanation makes sense and is correct; more of a
not-a-NAK so it doesn't look like a lack of response!)
--
To unsubscribe from this list: send the line "unsubscribe dmaengine" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Peter Ujfalusi March 28, 2015, 9:50 p.m. UTC | #2
Thanks,

On 03/28/2015 05:57 AM, Stephen Warren wrote:
> On 03/27/2015 05:35 AM, Peter Ujfalusi wrote:
>> The vd->node is removed from the lists when the transfer started so the
>> vchan_get_all_descriptors() will not find it. This results memory leak.
> 
> Acked-by: Stephen Warren <swarren@wwwdotorg.org>
> (I'm just assuming the explanation makes sense and is correct; more of a
> not-a-NAK so it doesn't look like a lack of response!)

I can not debug the bcm2835-dma driver, but the exact same pattern existed in
edma and omap-dma driver and they both leaked the edesc in a same predictable
fashion. I just checked the virt-dma users and sent the fixes for the ones
which had the same flow of events.
Vinod Koul March 30, 2015, 5:48 p.m. UTC | #3
On Fri, Mar 27, 2015 at 01:35:53PM +0200, Peter Ujfalusi wrote:
> The vd->node is removed from the lists when the transfer started so the
> vchan_get_all_descriptors() will not find it. This results memory leak.
> 
> Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
> CC: Stephen Warren <swarren@wwwdotorg.org>
> CC: Lee Jones <lee@kernel.org>
Applied, thanks
diff mbox

Patch

diff --git a/drivers/dma/bcm2835-dma.c b/drivers/dma/bcm2835-dma.c
index 0723096fb50a..c92d6a70ccf3 100644
--- a/drivers/dma/bcm2835-dma.c
+++ b/drivers/dma/bcm2835-dma.c
@@ -475,6 +475,7 @@  static int bcm2835_dma_terminate_all(struct dma_chan *chan)
 	 * c->desc is NULL and exit.)
 	 */
 	if (c->desc) {
+		bcm2835_dma_desc_free(&c->desc->vd);
 		c->desc = NULL;
 		bcm2835_dma_abort(c->chan_base);