Skip to content

Commit

Permalink
dma-buf: Fix memory leak in sync_file_merge()
Browse files Browse the repository at this point in the history
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: a02b9dc ("dma-buf/sync_file: refactor fence storage in struct sync_file")
Signed-off-by: Navid Emamdoost <[email protected]>
Cc: [email protected]
Signed-off-by: Daniel Vetter <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
  • Loading branch information
Navidem authored and danvet committed Nov 25, 2019
1 parent c131280 commit 6645d42
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/dma-buf/sync_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 6645d42

Please sign in to comment.