diff options
author | Navid Emamdoost <navid.emamdoost@gmail.com> | 2019-11-22 16:09:55 -0600 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-12-21 10:57:38 +0100 |
commit | 009484c9411838b3be72ccd67690120f43530150 (patch) | |
tree | 3c3f1dc3b5cc7de5d2a4877119bc1e33d2f29bdf /drivers/dma-buf | |
parent | 73155507af8fe30db7d8ca2e6e3b6c2aa13491a0 (diff) | |
download | linux-stable-009484c9411838b3be72ccd67690120f43530150.tar.gz linux-stable-009484c9411838b3be72ccd67690120f43530150.tar.bz2 linux-stable-009484c9411838b3be72ccd67690120f43530150.zip |
dma-buf: Fix memory leak in sync_file_merge()
commit 6645d42d79d33e8a9fe262660a75d5f4556bbea9 upstream.
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
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/dma-buf')
-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 35dd06479867..91d620994123 100644 --- a/drivers/dma-buf/sync_file.c +++ b/drivers/dma-buf/sync_file.c @@ -230,7 +230,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; |