linux/drivers/gpu/drm/i915/gem
Christian König d2da6696e0 drm/i915: fix incorrect RCU teardown order
i915_gem_busy_ioctl uses dma_resv_for_each_fence_unlocked() to iterate
over the fences in an GEM object without holding a reference but only
the RCU read side lock.

What can happen here is that the GEM object is destroyed concurrently
while i915_gem_busy_ioctl is still running. This won't free the GEM
objects memory, but still drops all the dma_fence references.

Now when dma_resv_for_each_fence_unlocked() sees a destroyed dma_fence it
assumes that a new fence list was installed and re-starts the loop.

But in the case of a destroyed GEM object a new fence list is never
installed, only the old one freed and therefore the iteration never
finishes resulting in an endless loop.

The solution is to drop the fence references only after the RCU grace
period.

The fixes tag is not necessary the patch introducing the problem, but the
one making it so worse that we need to address it.

This problem was pointed out by Sashiko-bot.

Signed-off-by: Christian König <christian.koenig@amd.com>
Fixes: 912ff2ebd6 ("drm/i915: use the new iterator in i915_gem_busy_ioctl v2")
CC: stable@vger.kernel.org
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>
Signed-off-by: Tvrtko Ursulin <tursulin@ursulin.net>
Link: https://lore.kernel.org/r/20260903113621.54660-1-christian.koenig@amd.com
(cherry picked from commit 5113479556025093bf8133bb2dcaa33be2d50921)
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
2026-09-22 12:18:20 +03:00
..
selftests drm/i915/selftests: Run vma tests only if current->mm is present 2026-05-19 13:29:27 +02:00
i915_gem_busy.c
i915_gem_clflush.c drm/i915/gem: unify i915 gem object frontbuffer function names 2026-03-11 11:32:10 +02:00
i915_gem_clflush.h
i915_gem_context_types.h
i915_gem_context.c drm/i915/gem: Do not leak siblings[] on proto context error 2026-07-06 10:26:13 -04:00
i915_gem_context.h
i915_gem_create.c Convert more 'alloc_obj' cases to default GFP_KERNEL arguments 2026-02-21 20:03:00 -08:00
i915_gem_create.h
i915_gem_dmabuf.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
i915_gem_dmabuf.h
i915_gem_domain.c x86/cpu: Hide and rename static_cpu_has() 2026-07-06 21:34:26 -07:00
i915_gem_domain.h
i915_gem_execbuffer.c Revert "i915: don't use a vma that didn't match the context VM" 2026-05-20 10:46:41 +03:00
i915_gem_internal.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
i915_gem_internal.h
i915_gem_ioctls.h
i915_gem_lmem.c
i915_gem_lmem.h
i915_gem_mman.c mm: introduce vma_get_page_prot() and use it 2026-08-06 18:57:03 -07:00
i915_gem_mman.h
i915_gem_object_frontbuffer.c drm/{i915, xe}/frontbuffer: move frontbuffer handling to parent interface 2026-03-11 11:32:10 +02:00
i915_gem_object_frontbuffer.h drm/{i915, xe}/frontbuffer: move frontbuffer handling to parent interface 2026-03-11 11:32:10 +02:00
i915_gem_object_types.h drm-misc-next for 6.19: 2025-12-26 18:15:33 +10:00
i915_gem_object.c drm/i915: fix incorrect RCU teardown order 2026-09-22 12:18:20 +03:00
i915_gem_object.h drm/i915/panic: split out i915_gem_panic.[ch] 2026-06-23 11:33:06 +03:00
i915_gem_pages.c drm/i915/panic: split out i915_gem_panic.[ch] 2026-06-23 11:33:06 +03:00
i915_gem_panic.c drm/{i915, xe}/panic: drop dependency on struct intel_framebuffer 2026-06-23 11:33:07 +03:00
i915_gem_panic.h drm/i915/panic: squash i915_panic.c into i915_gem_panic.c 2026-06-23 11:33:06 +03:00
i915_gem_phys.c drm/i915/gem: Fix phys BO pread/pwrite with offset 2026-06-10 09:23:22 +01:00
i915_gem_pm.c
i915_gem_pm.h
i915_gem_region.c
i915_gem_region.h
i915_gem_shmem.c shmem: provide a shmem_write_folio wrapper 2026-08-24 18:43:14 -07:00
i915_gem_shrinker.c drm: include drm_print.h where needed 2025-10-31 10:34:52 +02:00
i915_gem_shrinker.h
i915_gem_stolen.c drm/i915/pci: move intel_pci_config.h under include/drm/intel 2026-04-08 12:29:59 +03:00
i915_gem_stolen.h drm/{i915, xe}/stolen: move stolen memory handling to display parent interface 2025-12-10 11:36:11 +02:00
i915_gem_throttle.c
i915_gem_tiling.c drm/i915: include gen 2 in HAS_128_BYTE_Y_TILING() 2025-10-14 12:34:58 +03:00
i915_gem_tiling.h
i915_gem_ttm_move.c drm/i915: replace use of system_unbound_wq with system_dfl_wq 2026-03-05 13:58:22 -05:00
i915_gem_ttm_move.h
i915_gem_ttm_pm.c drm: include drm_print.h where needed 2025-10-31 10:34:52 +02:00
i915_gem_ttm_pm.h
i915_gem_ttm.c drm/i915: Fix potential UAF in TTM object purge 2026-05-26 09:31:40 +01:00
i915_gem_ttm.h
i915_gem_userptr.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
i915_gem_wait.c drm/i915/gem: add i915_gem_fence_wait_priority_display() helper 2025-09-25 11:41:59 +03:00