summaryrefslogtreecommitdiff
path: root/drivers/dma-buf
diff options
context:
space:
mode:
authorNavid Emamdoost <navid.emamdoost@gmail.com>2019-11-23 01:09:55 +0300
committerDaniel Vetter <daniel.vetter@ffwll.ch>2019-11-25 12:21:33 +0300
commit6645d42d79d33e8a9fe262660a75d5f4556bbea9 (patch)
treead329ce33e9f3ca9b9112cbf85aee0460b72273c /drivers/dma-buf
parentc131280c03bd1c225c2e64e9ef75873ffca3d96e (diff)
downloadlinux-6645d42d79d33e8a9fe262660a75d5f4556bbea9.tar.xz
dma-buf: Fix memory leak in sync_file_merge()
In the implementation of sync_file_merge() the allocated sync_file is leaked if number of fences overflows. Release sync_file by goto err. Fixes: a02b9dc90d84 ("dma-buf/sync_file: refactor fence storage in struct sync_file") Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com> Cc: stable@vger.kernel.org Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Link: https://patchwork.freedesktop.org/patch/msgid/20191122220957.30427-1-navid.emamdoost@gmail.com
Diffstat (limited to 'drivers/dma-buf')
-rw-r--r--drivers/dma-buf/sync_file.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/dma-buf/sync_file.c b/drivers/dma-buf/sync_file.c
index 25c5c071645b..91185db9a952 100644
--- a/drivers/dma-buf/sync_file.c
+++ b/drivers/dma-buf/sync_file.c
@@ -221,7 +221,7 @@ static struct sync_file *sync_file_merge(const char *name, struct sync_file *a,
a_fences = get_fences(a, &a_num_fences);
b_fences = get_fences(b, &b_num_fences);
if (a_num_fences > INT_MAX - b_num_fences)
- return NULL;
+ goto err;
num_fences = a_num_fences + b_num_fences;