dma-buf: cma_heap: Fix memory leak in CMA heap
PATCH 1/1 dma-buf: cma_heap: Fix memory leak in CMA heap
Bing Song noticed the CMA heap was leaking memory due to a flub I made in commit a5d2d29e24be ("dma-buf: heaps: Move heap-helper logic into the cma_heap implementation"), and provided this fix which ensures the pagelist is also freed on release.
--- drivers/dma-buf/heaps/cma_heap.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/dma-buf/heaps/cma_heap.c +3 -0
@@ -251,6 +251,9 @@ static void cma_heap_dma_buf_release(struct dma_buf *dmabuf) buffer->vaddr =NULL ; } +/* free page list */ +kfree (buffer->pages); +/* release memory */ cma_release (cma_heap->cma, buffer->cma_pages, buffer->pagecount);kfree (buffer); }
Signature · 6 lines
2.17.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Sumit Semwal
maintainerHi John,
Quoted 5 lines · John Stultz
Bing Song noticed the CMA heap was leaking memory due to a flub I made in commit
a5d2d29e24be("dma-buf: heaps: Move heap-helper logic into thecma_heapimplementation"), and provided this fix which ensures the pagelist is also freed on release.
Thanks for your patch.
Quoted 13 lines
Cc Bing Song <[email protected]>Cc Sumit Semwal <[email protected]>Cc Liam Mark <[email protected]>Cc Laura Abbott <[email protected]>Cc Brian Starkey <[email protected]>Cc Hridya Valsaraju <[email protected]>Cc Suren Baghdasaryan <[email protected]>Cc Sandeep Patil <[email protected]>Cc Daniel Mentz <[email protected]>Cc Chris Goldsworthy <[email protected]>Cc Ørjan Eide <[email protected]>Cc Robin Murphy <[email protected]>
Quoted 8 lines
Cc Ezequiel Garcia <[email protected]>Cc Simon Ser <[email protected]>Cc James Jones <[email protected]>Reported-by Bing Song <[email protected]>Fixes a5d2d29e24be ("dma-buf: heaps: Move heap-helper logic into the cma_heap implementation")Signed-off-by John Stultz <[email protected]>
I will queue it up so it gets in the v5.11 cycle.
Quoted 19 lines
--- drivers/dma-buf/heaps/cma_heap.c | 3 +++ 1 file changed, 3 insertions(+)drivers/dma-buf/heaps/cma_heap.c +3
-1@@ -251,6 +251,9 @@ static void cma_heap_dma_buf_release(struct dma_buf *dmabuf) buffer->vaddr =NULL ; } +/* free page list */ +kfree (buffer->pages); +/* release memory */ cma_release (cma_heap->cma, buffer->cma_pages, buffer->pagecount);kfree (buffer); } --
Quoted 2 lines
2.17.1
Best,
Sumit.
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel