2019-12-27 06:33:48

by Cong Wang

[permalink] [raw]
Subject: [PATCH] dma-buf: free dmabuf->name in dma_buf_release()

dma-buff name can be set via DMA_BUF_SET_NAME ioctl, but once set
it never gets freed.

Free it in dma_buf_release().

Fixes: bb2bb9030425 ("dma-buf: add DMA_BUF_SET_NAME ioctls")
Reported-by: [email protected]
Cc: Greg Hackmann <[email protected]>
Cc: Chenbo Feng <[email protected]>
Cc: Sumit Semwal <[email protected]>
Signed-off-by: Cong Wang <[email protected]>
---
drivers/dma-buf/dma-buf.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c
index ce41cd9b758a..2427398ff22a 100644
--- a/drivers/dma-buf/dma-buf.c
+++ b/drivers/dma-buf/dma-buf.c
@@ -108,6 +108,7 @@ static int dma_buf_release(struct inode *inode, struct file *file)
dma_resv_fini(dmabuf->resv);

module_put(dmabuf->owner);
+ kfree(dmabuf->name);
kfree(dmabuf);
return 0;
}
--
2.21.0


2020-02-18 18:41:53

by Chenbo Feng

[permalink] [raw]
Subject: Re: [PATCH] dma-buf: free dmabuf->name in dma_buf_release()

Acked-by: Chenbo Feng <[email protected]>


On Thu, Dec 26, 2019 at 10:32 PM Cong Wang <[email protected]> wrote:
>
> dma-buff name can be set via DMA_BUF_SET_NAME ioctl, but once set
> it never gets freed.
>
> Free it in dma_buf_release().
>
> Fixes: bb2bb9030425 ("dma-buf: add DMA_BUF_SET_NAME ioctls")
> Reported-by: [email protected]
> Cc: Greg Hackmann <[email protected]>
> Cc: Chenbo Feng <[email protected]>
> Cc: Sumit Semwal <[email protected]>
> Signed-off-by: Cong Wang <[email protected]>
> ---
> drivers/dma-buf/dma-buf.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c
> index ce41cd9b758a..2427398ff22a 100644
> --- a/drivers/dma-buf/dma-buf.c
> +++ b/drivers/dma-buf/dma-buf.c
> @@ -108,6 +108,7 @@ static int dma_buf_release(struct inode *inode, struct file *file)
> dma_resv_fini(dmabuf->resv);
>
> module_put(dmabuf->owner);
> + kfree(dmabuf->name);
> kfree(dmabuf);
> return 0;
> }
> --
> 2.21.0
>