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-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-fence-chain.c
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
Makefile
selftest.c
selftest.h
selftests.h
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