Skip to content

Commit

Permalink
dmaengine: hsu: Fix memory leak when stopping a running transfer
Browse files Browse the repository at this point in the history
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>
[andy: fix the typo to prevent a compilation error]
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
  • Loading branch information
Peter Ujfalusi authored and Vinod Koul committed Jun 2, 2015
1 parent 81cc6ed commit 4297708
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion drivers/dma/hsu/hsu.c
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,10 @@ static int hsu_dma_terminate_all(struct dma_chan *chan)
spin_lock_irqsave(&hsuc->vchan.lock, flags);

hsu_dma_stop_channel(hsuc);
hsuc->desc = NULL;
if (hsuc->desc) {
hsu_dma_desc_free(&hsuc->desc->vdesc);
hsuc->desc = NULL;
}

vchan_get_all_descriptors(&hsuc->vchan, &head);
spin_unlock_irqrestore(&hsuc->vchan.lock, flags);
Expand Down

0 comments on commit 4297708

Please sign in to comment.