Linux Media Controller development
 help / color / mirror / Atom feed
* [PATCH] dma-buf: Fix memory leak in sync_file_merge()
@ 2019-11-22 22:09 Navid Emamdoost
  2019-11-25  9:22 ` Daniel Vetter
  0 siblings, 1 reply; 2+ messages in thread
From: Navid Emamdoost @ 2019-11-22 22:09 UTC (permalink / raw)
  To: Sumit Semwal, Gustavo Padovan, linux-media, dri-devel,
	linaro-mm-sig, linux-kernel
  Cc: emamd001, Navid Emamdoost

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>
---
 drivers/dma-buf/sync_file.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/dma-buf/sync_file.c b/drivers/dma-buf/sync_file.c
index 25c5c071645b..91185db9a952 100644
--- a/drivers/dma-buf/sync_file.c
+++ b/drivers/dma-buf/sync_file.c
@@ -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;
 
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-11-25  9:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-11-22 22:09 [PATCH] dma-buf: Fix memory leak in sync_file_merge() Navid Emamdoost
2019-11-25  9:22 ` Daniel Vetter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox