[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAO_48GGyAhz_sXe22H6aZSiJQ2sSEgJ=HpaAkOfi-DmVmwvNtw@mail.gmail.com>
Date: Sat, 9 Jan 2021 09:14:14 +0530
From: Sumit Semwal <sumit.semwal@...aro.org>
To: John Stultz <john.stultz@...aro.org>
Cc: lkml <linux-kernel@...r.kernel.org>, Bing Song <bing.song@....com>,
Liam Mark <lmark@...eaurora.org>,
Laura Abbott <labbott@...nel.org>,
Brian Starkey <Brian.Starkey@....com>,
Hridya Valsaraju <hridya@...gle.com>,
Suren Baghdasaryan <surenb@...gle.com>,
Sandeep Patil <sspatil@...gle.com>,
Daniel Mentz <danielmentz@...gle.com>,
Chris Goldsworthy <cgoldswo@...eaurora.org>,
Ørjan Eide <orjan.eide@....com>,
Robin Murphy <robin.murphy@....com>,
Ezequiel Garcia <ezequiel@...labora.com>,
Simon Ser <contact@...rsion.fr>,
James Jones <jajones@...dia.com>,
"open list:DMA BUFFER SHARING FRAMEWORK"
<linux-media@...r.kernel.org>,
DRI mailing list <dri-devel@...ts.freedesktop.org>
Subject: Re: [PATCH] dma-buf: cma_heap: Fix memory leak in CMA heap
Hi John,
On Fri, 8 Jan 2021 at 01:56, John Stultz <john.stultz@...aro.org> wrote:
>
> 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.
Thanks for your patch.
>
> Cc: Bing Song <bing.song@....com>
> Cc: Sumit Semwal <sumit.semwal@...aro.org>
> Cc: Liam Mark <lmark@...eaurora.org>
> Cc: Laura Abbott <labbott@...nel.org>
> Cc: Brian Starkey <Brian.Starkey@....com>
> Cc: Hridya Valsaraju <hridya@...gle.com>
> Cc: Suren Baghdasaryan <surenb@...gle.com>
> Cc: Sandeep Patil <sspatil@...gle.com>
> Cc: Daniel Mentz <danielmentz@...gle.com>
> Cc: Chris Goldsworthy <cgoldswo@...eaurora.org>
> Cc: Ørjan Eide <orjan.eide@....com>
> Cc: Robin Murphy <robin.murphy@....com>
> Cc: Ezequiel Garcia <ezequiel@...labora.com>
> Cc: Simon Ser <contact@...rsion.fr>
> Cc: James Jones <jajones@...dia.com>
> Cc: linux-media@...r.kernel.org
> Cc: dri-devel@...ts.freedesktop.org
> Reported-by: Bing Song <bing.song@....com>
> Fixes: a5d2d29e24be ("dma-buf: heaps: Move heap-helper logic into the cma_heap implementation")
> Signed-off-by: John Stultz <john.stultz@...aro.org>
I will queue it up so it gets in the v5.11 cycle.
> ---
> drivers/dma-buf/heaps/cma_heap.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/dma-buf/heaps/cma_heap.c b/drivers/dma-buf/heaps/cma_heap.c
> index 3c4e34301172..364fc2f3e499 100644
> --- a/drivers/dma-buf/heaps/cma_heap.c
> +++ b/drivers/dma-buf/heaps/cma_heap.c
> @@ -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);
> }
> --
> 2.17.1
>
Best,
Sumit.
Powered by blists - more mailing lists