]> Git Repo - linux.git/commitdiff
dma-buf: Fix memory leak in sync_file_merge()
authorNavid Emamdoost <[email protected]>
Fri, 22 Nov 2019 22:09:55 +0000 (16:09 -0600)
committerDaniel Vetter <[email protected]>
Mon, 25 Nov 2019 09:21:33 +0000 (10:21 +0100)
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 <[email protected]>
Cc: [email protected]
Signed-off-by: Daniel Vetter <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
drivers/dma-buf/sync_file.c

index 25c5c071645bda31f47e1dd9155ab9a763933b2b..91185db9a952f872a1ad4d5b7aead1af21299d97 100644 (file)
@@ -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;
 
This page took 0.054075 seconds and 4 git commands to generate.