Files
linux/drivers/gpu/drm
Zhenghang Xiao 7164d78559 drm/gem: fix race between change_handle and handle_delete
drm_gem_change_handle_ioctl leaves the old handle live in the IDR
during the window between spin_unlock(table_lock) and the final
spin_lock(table_lock). A concurrent drm_gem_handle_delete on the old
handle succeeds in this window, decrements handle_count to 0, and frees
the GEM object while the new handle's IDR entry still references it.

NULL the old handle's IDR entry before dropping table_lock so that any
concurrent GEM_CLOSE on the old handle sees NULL and returns -EINVAL.
Restore the old entry on the prime-bookkeeping error path.

Fixes: 5e28b7b944 ("drm: Set old handle to NULL before prime swap in change_handle")
Signed-off-by: Zhenghang Xiao <kipreyyy@gmail.com>
Cc: stable@vger.kernel.org
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patch.msgid.link/20260526085313.26791-1-kipreyyy@gmail.com
2026-05-30 07:01:39 +10:00
..
2025-10-31 10:34:52 +02:00
2026-03-10 09:42:09 +08:00
2026-05-04 14:54:44 +02:00
2026-03-11 11:18:31 +01:00
2026-03-17 17:50:49 +01:00
2026-04-28 10:50:41 +02:00
2026-04-07 12:36:31 +02:00
2025-10-31 10:34:52 +02:00
2026-04-07 12:36:31 +02:00
2025-08-21 16:21:08 +02:00
2026-03-12 07:23:23 -07:00