linux-stable/drivers/dma-buf
Rob Clark 3282e79a85 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 16:11:12 +02:00
..
heaps dma-buf-map: Rename to iosys-map 2022-02-07 16:35:35 -08:00
dma-buf-sysfs-stats.c dma-buf: fix dma_buf_export init order v2 2023-01-24 07:24:30 +01:00
dma-buf-sysfs-stats.h dma-buf: fix dma_buf_export init order v2 2023-01-24 07:24:30 +01:00
dma-buf.c dma-buf: fix dma_buf_export init order v2 2023-01-24 07:24:30 +01:00
dma-fence-array.c dma-buf: handle empty dma_fence_arrays gracefully 2022-03-29 09:14:30 +02:00
dma-fence-chain.c dma-buf: cleanup dma_fence_chain_walk 2022-05-30 11:24:50 +02:00
dma-fence-unwrap.c dma-buf: keep the signaling time of merged fences v3 2023-08-03 10:24:19 +02:00
dma-fence.c dma-buf: fix an error pointer vs NULL bug 2023-08-03 10:24:19 +02:00
dma-heap.c dma-buf: fix racing conflict of dma_heap_add() 2022-11-22 18:27:56 +05:30
dma-resv.c dma-buf/dma-resv: Stop leaking on krealloc() failure 2023-07-27 08:50:27 +02:00
Kconfig dma-buf: deprecate DMABUF_SYSFS_STATS 2022-06-23 10:51:43 +02:00
Makefile dma-buf: cleanup dma_fence_unwrap implementation 2022-05-30 14:16:32 +02:00
selftest.c
selftest.h
selftests.h dma-buf: add dma_fence_unwrap v2 2022-03-25 14:18:28 +01:00
st-dma-fence-chain.c dma-buf: Enable signaling on fence for selftests 2022-09-16 15:53:25 +02:00
st-dma-fence-unwrap.c dma-buf: Enable signaling on fence for selftests 2022-09-16 15:53:25 +02:00
st-dma-fence.c dma-buf: Enable signaling on fence for selftests 2022-09-16 15:53:25 +02:00
st-dma-resv.c dma-buf: Enable signaling on fence for selftests 2022-09-16 15:53:25 +02:00
sw_sync.c dma-buf/sw_sync: Avoid recursive lock during fence signal 2023-08-30 16:11:12 +02:00
sync_debug.c
sync_debug.h
sync_file.c dma-buf/sync_file: use strscpy to replace strlcpy 2022-08-10 13:50:49 +02:00
sync_trace.h
udmabuf.c whack-a-mole: cropped up open-coded file_inode() uses... 2022-10-06 17:22:11 -07:00