summaryrefslogtreecommitdiffstats
path: root/drivers/dma-buf
diff options
context:
space:
mode:
authorColin Ian King <colin.king@canonical.com>2019-12-16 16:10:59 +0000
committerSumit Semwal <sumit.semwal@linaro.org>2019-12-17 22:28:14 +0530
commitf9d3b2c600075d1f79efcd5cdb1718c2f554c0f9 (patch)
treefb26ec347045da28cf10ab0c76e442e92b1a6b09 /drivers/dma-buf
parent8b6fc114beeb9f1a270e5b6d25c30a5143801bf8 (diff)
downloadlinux-f9d3b2c600075d1f79efcd5cdb1718c2f554c0f9.tar.bz2
dma-buf: fix resource leak on -ENOTTY error return path
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> Signed-off-by: Sumit Semwal <sumit.semwal@linaro.org> Link: https://patchwork.freedesktop.org/patch/msgid/20191216161059.269492-1-colin.king@canonical.com
Diffstat (limited to 'drivers/dma-buf')
-rw-r--r--drivers/dma-buf/dma-heap.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/dma-buf/dma-heap.c b/drivers/dma-buf/dma-heap.c
index a24721496114..1886aee46131 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)