linux/drivers/dma-buf
Christian König 3ed11c671f dma-buf/dma-fence: fix checking signaling bit for timeline and driver name v3
The patch "dma-buf: dma-fence: Fix potential NULL pointer dereference"
changed the check to test for the ops pointer instead of the signaled
bit to avoid a potential NULL dereference when the ops pointer has been
cleared.

The problem is now that the ops pointer is cleared only when neither the
release nor the wait callback is implemented and this isn't true for a lot
of dma_fence implementations yet. So those implementations lost the RCU
protection after signaling of the returned string resulting in potential
use after free.

Add the signaling check additional to the ops pointer check so that we
have both the protection against NULL dereference as well as the RCU
protection after signaling for the returned string.

v2: improve comments to note RCU protection and explain why we check
    both signaling state and ops pointer
v3: some comment improvements suggested by Philip

Signed-off-by: Christian König <christian.koenig@amd.com>
Fixes: 035219a760 ("dma-buf: dma-fence: Fix potential NULL pointer dereference")
CC: stable@vger.kernel.org # 7.2+
Reported-by: Jonghyuk Kim(MalHyuk) <malhyuk97@gmail.com>
Tested-by: Jonghyuk Kim(MalHyuk) <malhyuk97@gmail.com>
Reviewed-by: Philipp Stanner <phasta@kernel.org>
Link: https://lore.kernel.org/r/20260914182740.1587-1-christian.koenig@amd.com
2026-09-15 10:02:53 +02:00
..
heaps dma-buf: move system_cc_shared heap under separate Kconfig 2026-06-11 20:21:44 +05:30
.kunitconfig dma-buf: Change st-dma-resv.c to use kunit 2026-04-16 12:34:00 +02:00
dma-buf-mapping.c dma-buf: Split sgl by largest page-aligned chunk 2026-09-11 12:10:01 +02:00
dma-buf.c dma-buf: dma-heap: don't publish fd before copy_to_user() succeeds 2026-08-24 13:57:59 +02:00
dma-fence-array.c dma-buf/dma_fence_array: remove unused functionality v4 2026-05-04 16:28:14 +02:00
dma-fence-chain.c dma-buf: Assign separate lockdep class to chain lock 2026-02-25 01:16:11 -08:00
dma-fence-unwrap.c Merge drm/drm-next into drm-misc-next 2026-07-08 13:00:55 +02:00
dma-fence.c dma-buf/dma-fence: fix checking signaling bit for timeline and driver name v3 2026-09-15 10:02:53 +02:00
dma-heap.c Merge drm/drm-fixes into drm-misc-fixes 2026-09-01 09:38:51 +02:00
dma-resv.c dma-buf/dma_fence_array: remove unused functionality v4 2026-05-04 16:28:14 +02:00
Kconfig dma-buf: Make DMABUF_DEBUG default to y on DEBUG_KERNEL kernels 2026-09-11 11:55:40 +02:00
Makefile dma-buf: Remove the old selftest 2026-04-16 12:34:00 +02:00
st-dma-fence-chain.c dma-buf: rename dma_fence_enable_sw_signaling 2026-07-01 16:52:48 +02:00
st-dma-fence-unwrap.c dma-buf: rename dma_fence_enable_sw_signaling 2026-07-01 16:52:48 +02:00
st-dma-fence.c treewide: refresh kmalloc_obj() conversions 2026-09-04 21:37:00 -07:00
st-dma-resv.c dma-buf: rename dma_fence_enable_sw_signaling 2026-07-01 16:52:48 +02:00
sw_sync.c dma-buf: abstract fence locking v2 2026-02-23 16:14:19 +01:00
sync_debug.c dma-buf: Switch to use %ptSp 2025-11-19 10:24:13 +01:00
sync_debug.h dma-buf: inline spinlock for fence protection v5 2026-02-23 16:14:19 +01:00
sync_file.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
sync_trace.h tracing/treewide: Remove second parameter of __assign_str() 2024-05-22 20:14:47 -04:00
udmabuf.c treewide: refresh kmalloc_obj() conversions 2026-09-04 21:37:00 -07:00