* [PATCH][next] dma-buf: fix resource leak on -ENOTTY error return path
@ 2019-12-16 16:10 Colin King
2019-12-16 21:07 ` John Stultz
0 siblings, 1 reply; 2+ messages in thread
From: Colin King @ 2019-12-16 16:10 UTC (permalink / raw)
To: Sumit Semwal, Andrew F . Davis, Benjamin Gaignard, Liam Mark,
Laura Abbott, Brian Starkey, John Stultz, Sandeep Patil,
linux-media, dri-devel, linaro-mm-sig
Cc: kernel-janitors, linux-kernel
From: Colin Ian King <colin.king@canonical.com>
The -ENOTTY error return path does not free the allocated
kdata as it returns directly. Fix this by returning via the
error handling label err.
Addresses-Coverity: ("Resource leak")
Fixes: c02a81fba74f ("dma-buf: Add dma-buf heaps framework")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
drivers/dma-buf/dma-heap.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/dma-buf/dma-heap.c b/drivers/dma-buf/dma-heap.c
index 4f04d104ae61..80f2f5eac1e4 100644
--- a/drivers/dma-buf/dma-heap.c
+++ b/drivers/dma-buf/dma-heap.c
@@ -157,7 +157,8 @@ static long dma_heap_ioctl(struct file *file, unsigned int ucmd,
ret = dma_heap_ioctl_allocate(file, kdata);
break;
default:
- return -ENOTTY;
+ ret = -ENOTTY;
+ goto err;
}
if (copy_to_user((void __user *)arg, kdata, out_size) != 0)
--
2.24.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH][next] dma-buf: fix resource leak on -ENOTTY error return path
2019-12-16 16:10 [PATCH][next] dma-buf: fix resource leak on -ENOTTY error return path Colin King
@ 2019-12-16 21:07 ` John Stultz
0 siblings, 0 replies; 2+ messages in thread
From: John Stultz @ 2019-12-16 21:07 UTC (permalink / raw)
To: Colin King
Cc: Sumit Semwal, Andrew F . Davis, Benjamin Gaignard, Liam Mark,
Laura Abbott, Brian Starkey, Sandeep Patil, linux-media,
dri-devel, moderated list:DMA BUFFER SHARING FRAMEWORK,
kernel-janitors, lkml
On Mon, Dec 16, 2019 at 8:11 AM Colin King <colin.king@canonical.com> wrote:
>
> From: Colin Ian King <colin.king@canonical.com>
>
> The -ENOTTY error return path does not free the allocated
> kdata as it returns directly. Fix this by returning via the
> error handling label err.
>
> Addresses-Coverity: ("Resource leak")
> Fixes: c02a81fba74f ("dma-buf: Add dma-buf heaps framework")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
Acked-by: John Stultz <john.stultz@linaro.org>
Thanks so much for submitting this!
Sumit, do you mind queueing this up for drm-misc-next?
thanks
-john
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-12-16 21:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-16 16:10 [PATCH][next] dma-buf: fix resource leak on -ENOTTY error return path Colin King
2019-12-16 21:07 ` John Stultz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).