linux-stable/drivers/dma-buf
Jason Ekstrand e0355a0ad3 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:13:45 +02:00
..
dma-buf.c dma-buf: balance refcount inbalance 2019-07-28 08:29:28 +02:00
dma-fence-array.c dma-fence: Make ->wait callback optional 2018-07-03 13:12:57 +02:00
dma-fence.c dma-fence: Serialise signal enabling (dma_fence_enable_sw_signaling) 2020-10-01 13:14:24 +02:00
Kconfig
Makefile
reservation.c dma-buf: Discard old fence_excl on retrying get_fences_rcu for realloc 2019-07-28 08:29:28 +02:00
seqno-fence.c
sw_sync.c dma-buf/sw_sync: Synchronize signal vs syncpt free 2019-10-07 18:57:04 +02:00
sync_debug.c Linux 4.13-rc2 2017-07-27 08:15:43 +10:00
sync_debug.h dma-buf: Remove unneeded stubs around sync_debug interfaces 2018-05-07 15:58:07 +02:00
sync_file.c dma-buf/sync_file: Don't leak fences on merge failure 2021-07-28 11:13:45 +02:00
sync_trace.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00