Commit 6645d42d authored by Navid Emamdoost's avatar Navid Emamdoost Committed by Daniel Vetter

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: a02b9dc9 ("dma-buf/sync_file: refactor fence storage in struct sync_file")
Signed-off-by: default avatarNavid Emamdoost <navid.emamdoost@gmail.com>
Cc: stable@vger.kernel.org
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20191122220957.30427-1-navid.emamdoost@gmail.com
parent c131280c
...@@ -221,7 +221,7 @@ static struct sync_file *sync_file_merge(const char *name, struct sync_file *a, ...@@ -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); a_fences = get_fences(a, &a_num_fences);
b_fences = get_fences(b, &b_num_fences); b_fences = get_fences(b, &b_num_fences);
if (a_num_fences > INT_MAX - b_num_fences) if (a_num_fences > INT_MAX - b_num_fences)
return NULL; goto err;
num_fences = a_num_fences + b_num_fences; num_fences = a_num_fences + b_num_fences;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment