Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

dma-buf: Assign separate lockdep class to array lock

dma_fence_array_enable_signaling() runs while holding the array
inline_lock and may add callbacks to underlying fences, which takes
their inline_lock.

Since both locks share the same lockdep class, this valid nesting
triggers a recursive locking warning. Assign a distinct lockdep class
to the array inline_lock so lockdep can correctly model the hierarchy.

Fixes: 5943243914b9 ("dma-buf: use inline lock for the dma-fence-array")
Cc: Christian König <christian.koenig@amd.com>
Cc: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>
Cc: Philipp Stanner <phasta@kernel.org>
Cc: Boris Brezillon <boris.brezillon@collabora.com>
Signed-off-by: Matthew Brost <matthew.brost@intel.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Link: https://patch.msgid.link/20260224183922.2256492-2-matthew.brost@intel.com

+14
+14
drivers/dma-buf/dma-fence-array.c
··· 200 200 u64 context, unsigned seqno, 201 201 bool signal_on_any) 202 202 { 203 + static struct lock_class_key dma_fence_array_lock_key; 204 + 203 205 WARN_ON(!num_fences || !fences); 204 206 205 207 array->num_fences = num_fences; ··· 209 207 dma_fence_init(&array->base, &dma_fence_array_ops, NULL, context, 210 208 seqno); 211 209 init_irq_work(&array->work, irq_dma_fence_array_work); 210 + 211 + /* 212 + * dma_fence_array_enable_signaling() is invoked while holding 213 + * array->base.inline_lock and may call dma_fence_add_callback() 214 + * on the underlying fences, which takes their inline_lock. 215 + * 216 + * Since both locks share the same lockdep class, this legitimate 217 + * nesting confuses lockdep and triggers a recursive locking 218 + * warning. Assign a separate lockdep class to the array lock 219 + * to model this hierarchy correctly. 220 + */ 221 + lockdep_set_class(&array->base.inline_lock, &dma_fence_array_lock_key); 212 222 213 223 atomic_set(&array->num_pending, signal_on_any ? 1 : num_fences); 214 224 array->fences = fences;