[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20191216161059.269492-1-colin.king@canonical.com>
Date: Mon, 16 Dec 2019 16:10:59 +0000
From: Colin King <colin.king@...onical.com>
To: Sumit Semwal <sumit.semwal@...aro.org>,
"Andrew F . Davis" <afd@...com>,
Benjamin Gaignard <benjamin.gaignard@...aro.org>,
Liam Mark <lmark@...eaurora.org>,
Laura Abbott <labbott@...hat.com>,
Brian Starkey <brian.starkey@....com>,
John Stultz <john.stultz@...aro.org>,
Sandeep Patil <sspatil@...roid.com>,
linux-media@...r.kernel.org, dri-devel@...ts.freedesktop.org,
linaro-mm-sig@...ts.linaro.org
Cc: kernel-janitors@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH][next] dma-buf: fix resource leak on -ENOTTY error return path
From: Colin Ian King <colin.king@...onical.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@...onical.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
Powered by blists - more mailing lists