linux-stable/drivers/dma-buf
Rob Clark c6e1fcd50c dma-buf/sw_sync: Avoid recursive lock during fence signal
[ Upstream commit e531fdb5cd ]

If a signal callback releases the sw_sync fence, that will trigger a
deadlock as the timeline_fence_release recurses onto the fence->lock
(used both for signaling and the the timeline tree).

To avoid that, temporarily hold an extra reference to the signalled
fences until after we drop the lock.

(This is an alternative implementation of https://patchwork.kernel.org/patch/11664717/
which avoids some potential UAF issues with the original patch.)

v2: Remove now obsolete comment, use list_move_tail() and
    list_del_init()

Reported-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Fixes: d3c6dd1fb3 ("dma-buf/sw_sync: Synchronize signal vs syncpt free")
Signed-off-by: Rob Clark <robdclark@chromium.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20230818145939.39697-1-robdclark@gmail.com
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-08-30 14:52:44 +02:00
..
heaps - Nick Piggin's "shoot lazy tlbs" series, to improve the peformance of 2023-04-27 19:42:02 -07:00
Kconfig
Makefile
dma-buf-sysfs-stats.c dma-buf: make kobj_type structure constant 2023-02-17 10:59:14 +01:00
dma-buf-sysfs-stats.h dma-buf: fix dma_buf_export init order v2 2022-12-13 08:31:45 +01:00
dma-buf.c dma-buf: Include missing parentheses to documentation 2023-03-03 14:35:09 -03:00
dma-fence-array.c dma-buf/fence-array: Add fence deadline support 2023-03-25 10:55:07 -07:00
dma-fence-chain.c dma-buf/fence-chain: Add fence deadline support 2023-03-28 13:38:52 -07:00
dma-fence-unwrap.c dma-buf: keep the signaling time of merged fences v3 2023-08-03 10:26:14 +02:00
dma-fence.c dma-buf: fix an error pointer vs NULL bug 2023-08-03 10:26:14 +02:00
dma-heap.c driver core: class: remove module * from class_create() 2023-03-17 15:16:33 +01:00
dma-resv.c dma-buf/dma-resv: Stop leaking on krealloc() failure 2023-07-27 08:56:38 +02:00
selftest.c
selftest.h
selftests.h
st-dma-fence-chain.c treewide: use get_random_u32_inclusive() when possible 2022-11-18 02:18:02 +01:00
st-dma-fence-unwrap.c
st-dma-fence.c
st-dma-resv.c
sw_sync.c dma-buf/sw_sync: Avoid recursive lock during fence signal 2023-08-30 14:52:44 +02:00
sync_debug.c
sync_debug.h
sync_file.c
sync_trace.h
udmabuf.c udmabuf: revert 'Add support for mapping hugepages (v4)' 2023-06-19 13:19:32 -07:00