dma-buf: Fix memory leak in sync_file_merge()
Subsystems (3)
PATCH 1/1 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 <[email protected]>
--- drivers/dma-buf/sync_file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/dma-buf/sync_file.c +1 -1
@@ -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;
Signature · 1 line
2.17.1
Quoted 5 lines · Navid Emamdoost
In the implementation of
sync_file_merge()the allocatedsync_fileis leaked if number of fences overflows. Releasesync_fileby goto err.Fixes a02b9dc90d84 ("dma-buf/sync_file: refactor fence storage in struct sync_file")Signed-off-by Navid Emamdoost <[email protected]>
Thanks for your patch, applied with a cc:stable.
-Daniel
Quoted 24 lines
--- drivers/dma-buf/sync_file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/dma-buf/sync_file.c +1
-1@@ -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;Signature · 6 lines
2.17.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel