linux-stable/drivers/dma-buf
Jason Ekstrand 19f51c2529 dma-buf/sync_file: Don't leak fences on merge failure
commit ffe000217c upstream.

Each add_fence() call does a dma_fence_get() on the relevant fence.  In
the error path, we weren't calling dma_fence_put() so all those fences
got leaked.  Also, in the krealloc_array failure case, we weren't
freeing the fences array.  Instead, ensure that i and fences are always
zero-initialized and dma_fence_put() all the fences and kfree(fences) on
every error path.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Christian König <christian.koenig@amd.com>
Fixes: a02b9dc90d ("dma-buf/sync_file: refactor fence storage in struct sync_file")
Cc: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Cc: Christian König <christian.koenig@amd.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210624174732.1754546-1-jason@jlekstrand.net
Signed-off-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-07-28 11:12:16 +02:00
..
dma-buf.c dma-buf: balance refcount inbalance 2019-07-31 07:28:47 +02:00
dma-fence-array.c
dma-fence.c
Kconfig
Makefile
reservation.c dma-buf: Discard old fence_excl on retrying get_fences_rcu for realloc 2019-07-31 07:28:47 +02:00
seqno-fence.c
sw_sync.c dma-buf/sw_sync: Synchronize signal vs syncpt free 2019-10-07 18:55:07 +02:00
sync_debug.c
sync_debug.h
sync_file.c dma-buf/sync_file: Don't leak fences on merge failure 2021-07-28 11:12:16 +02:00
sync_trace.h