diff options
author | Navid Emamdoost <navid.emamdoost@gmail.com> | 2019-11-22 23:09:55 +0100 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2019-11-25 10:21:33 +0100 |
commit | 6645d42d79d33e8a9fe262660a75d5f4556bbea9 (patch) | |
tree | ad329ce33e9f3ca9b9112cbf85aee0460b72273c /drivers/dma-buf/sync_file.c | |
parent | drm/mcde: dsi: Fix invalid pointer dereference if panel cannot be found (diff) | |
download | linux-6645d42d79d33e8a9fe262660a75d5f4556bbea9.tar.xz linux-6645d42d79d33e8a9fe262660a75d5f4556bbea9.zip |
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/sync_file.c')
-rw-r--r-- | drivers/dma-buf/sync_file.c | 2 |
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; |