linux/include/drm
Christian König 26401a4999 drm/exec: don't immediately add prelocked obj to array of locked objs
When a contention is detected the drm_exec object grabs a reference to
the contended object, unlocks all other objects and pre-locks the
contended one before anything else.

The problem is that it is possible that this pre-locked object was about
to be destroyed and drm_exec is now holding the last reference to it.

So we never actually see this pre-locked object again to be explicitly
locked and so also never reserve a slot for a dma_fence object on it.

Should the driver now use drm_exec_for_each_locked_object() to add a new
fence to all locked objects we eventually see a warning or even a
BUG_ON() to prevent random memory corruption.

Fix this by keeping the prelocked object out of the array of locked objs
until it was explicitly mentioned by the driver again.

If the prelocked object is never mentioned again by the driver
just unlock and drop the reference at the end of the locking loop.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reported-by: Vitaly Prosyak <vitaly.prosyak@amd.com>
Reviewed-by: Vitaly Prosyak <vitaly.prosyak@amd.com>
Tested-by: Vitaly Prosyak <vitaly.prosyak@amd.com>
Fixes: 09593216bf ("drm: execution context for GEM buffers v7")
CC: stable@vger.kernel.org # v6.6+
Link: https://lore.kernel.org/r/20261007124657.9664-1-christian.koenig@amd.com
2026-10-14 13:57:14 +02:00
..
amd
bridge drm/bridge: analogix_dp: Add support for RK3576 2026-06-02 22:09:03 +02:00
clients
display Merge tag 'drm-intel-next-2026-07-28' of https://gitlab.freedesktop.org/drm/i915/kernel into drm-next 2026-08-01 06:05:01 +10:00
intel UAPI Changes: 2026-07-07 15:19:56 +10:00
ttm Linux 7.2 2026-08-20 10:58:44 +10:00
amd_asic_type.h
drm_accel.h
drm_atomic_helper.h drm/atomic-helper: Add HDMI bridge output bus formats helper 2026-06-09 21:03:50 +01:00
drm_atomic_state_helper.h drm/atomic-state-helper: Remove drm_atomic_helper_bridge_reset() 2026-06-22 11:24:57 +02:00
drm_atomic_uapi.h drm/atomic: track individual colorop updates 2026-06-10 07:13:36 -03:00
drm_atomic.h drm/atomic: Expand atomic_create_state expectations for drm_private_obj 2026-05-29 11:41:49 +02:00
drm_audio_component.h
drm_auth.h
drm_blend.h drm: Rename struct drm_atomic_state to drm_atomic_commit 2026-05-04 14:05:04 +10:00
drm_bridge_connector.h
drm_bridge_helper.h
drm_bridge.h drm/bridge: Replace outdated forward declaration 2026-07-27 13:30:09 +02:00
drm_buddy.h gpu: Move DRM buddy allocator one level up (part two) 2026-02-06 11:38:35 +10:00
drm_cache.h
drm_client_event.h drm/client: Pass force parameter to client restore 2025-11-25 08:43:46 +01:00
drm_client.h drm/client: Export drm_client_buffer_create() 2026-03-03 09:28:31 +01:00
drm_color_mgmt.h drm: Add helper to extract lut from struct drm_color_lut32 2025-11-26 23:03:35 +01:00
drm_colorop.h drm-misc-next for 7.3: 2026-07-06 17:38:49 +10:00
drm_connector.h drm/connector: Fix epoch_counter docs to reflect reality 2026-07-21 17:06:42 +01:00
drm_crtc_helper.h drm: Rename struct drm_atomic_state to drm_atomic_commit 2026-05-04 14:05:04 +10:00
drm_crtc.h drm/crtc: Add new atomic_create_state callback 2026-05-29 11:41:53 +02:00
drm_damage_helper.h drm: Rename struct drm_atomic_state to drm_atomic_commit 2026-05-04 14:05:04 +10:00
drm_debugfs_crc.h drm/crc: Fix typo in doc for drm_crtc_crc 2026-05-04 14:26:53 +02:00
drm_debugfs.h drm: Remove DRIVER_GEM_GPUVA feature flag 2026-05-29 19:03:10 +02:00
drm_device.h drm/gem: Make the GEM LRU lock part of drm_device 2026-05-18 15:16:47 +02:00
drm_drv.h cgroup/dmem: Introduce struct dmem_cgroup_init for region initialization 2026-08-06 23:37:56 +02:00
drm_dumb_buffers.h drm/dumb-buffers: Provide helper to set pitch and size 2025-09-29 13:57:43 +02:00
drm_edid.h Revert "drm/edid: add CTA Video Format Data Block support" 2026-05-06 11:22:15 +02:00
drm_eld.h
drm_encoder.h drm/encoder: add mutex to protect the bridge chain 2026-04-16 09:08:42 +02:00
drm_exec.h drm/exec: don't immediately add prelocked obj to array of locked objs 2026-10-14 13:57:14 +02:00
drm_fb_dma_helper.h
drm_fb_helper.h drm/amdgpu: fix build for CONFIG_DRM_FBDEV_EMULATION=n 2026-04-28 15:43:04 -04:00
drm_fbdev_dma.h
drm_fbdev_shmem.h
drm_fbdev_ttm.h
drm_file.h drm/syncobj: Convert syncobj idr to xarray 2025-12-18 09:05:30 +00:00
drm_fixed.h drm/fixed: fix kernel-doc for drm_sm2fixp() 2026-06-30 12:31:20 +03:00
drm_flip_work.h
drm_format_helper.h drm/format-helper: Remove drm_fb_blit() 2025-09-23 15:06:06 +02:00
drm_fourcc.h
drm_framebuffer.h
drm_gem_atomic_helper.h
drm_gem_dma_helper.h
drm_gem_framebuffer_helper.h
drm_gem_shmem_helper.h Merge drm/drm-next into drm-misc-next 2026-06-30 10:16:00 +02:00
drm_gem_ttm_helper.h
drm_gem_vram_helper.h
drm_gem.h drm: Remove DRIVER_GEM_GPUVA feature flag 2026-05-29 19:03:10 +02:00
drm_gpusvm.h drm/gpusvm: let the drm_gpusvm core context purely MM level 2026-07-09 04:12:49 -07:00
drm_gpuvm.h drm/gpuvm: Fix comment to reflect remap operation operand status 2026-07-03 23:32:55 +02:00
drm_ioctl.h
drm_kunit_helpers.h drm: Rename struct drm_atomic_state to drm_atomic_commit 2026-05-04 14:05:04 +10:00
drm_lease.h
drm_managed.h drm/managed: fix drmm_add_action() kernel-doc 2026-06-03 11:24:52 +02:00
drm_mipi_dbi.h drm: Rename struct drm_atomic_state to drm_atomic_commit 2026-05-04 14:05:04 +10:00
drm_mipi_dsi.h drm/mipi-dsi: add flag for sending all DSC slices in one packet 2026-06-07 02:31:01 +03:00
drm_mm.h drm/mm: replace drm_print.h include with a forward declaration 2025-10-31 10:34:56 +02:00
drm_mode_config.h drm/mode-config: Create drm_mode_config_create_initial_state() 2026-05-29 11:42:45 +02:00
drm_mode_object.h drm/mode_object: add drm_object_immutable_property_get_value() 2026-01-14 02:18:31 +02:00
drm_modes.h drm/modes: Add DRM_MODE_MATCH_TIMINGS_VRR 2026-06-24 18:54:10 +03:00
drm_modeset_helper_vtables.h drm: Rename struct drm_atomic_state to drm_atomic_commit 2026-05-04 14:05:04 +10:00
drm_modeset_helper.h
drm_modeset_lock.h
drm_module.h
drm_of.h drm/of: Implement drm_of_get_panel_orientation() 2026-07-08 13:44:40 +02:00
drm_pagemap_util.h drm/pagemap_util: Add a utility to assign an owner to a set of interconnected gpus 2025-12-23 10:00:47 +01:00
drm_pagemap.h drm/pagemap: Prevent double migration of device pages 2026-08-31 14:56:03 -07:00
drm_panel.h drm/panel: Use drm_of_get_panel_orientation() 2026-07-08 13:54:58 +02:00
drm_panic.h
drm_pciids.h
drm_plane_helper.h
drm_plane.h drm/plane: Add new atomic_create_state callback 2026-05-29 11:41:52 +02:00
drm_prime.h
drm_print.h drm/print: describe 6th & 9th bit of drm.debug 2026-06-03 11:24:52 +02:00
drm_privacy_screen_consumer.h
drm_privacy_screen_driver.h
drm_privacy_screen_machine.h
drm_probe_helper.h
drm_property.h drm/atomic: add max_size check to drm_property_replace_blob_from_id() 2026-01-14 02:18:31 +02:00
drm_ras_genl_family.h drm/ras: Introduce the DRM RAS infrastructure over generic netlink 2026-03-05 19:38:55 -05:00
drm_ras.h drm/ras: include linux/types.h in drm_ras.h 2026-06-30 15:51:24 +03:00
drm_rect.h
drm_self_refresh_helper.h drm: Rename struct drm_atomic_state to drm_atomic_commit 2026-05-04 14:05:04 +10:00
drm_simple_kms_helper.h drm/simple-kms: Deprecate simple-kms helpers 2026-03-25 15:05:22 +01:00
drm_suballoc.h drm/sa: Split drm_suballoc_new() into SA alloc and init helpers 2026-02-20 10:54:02 -08:00
drm_syncobj.h
drm_sysfs.h
drm_util.h
drm_utils.h drm/amd/display: Force PWM backlight on Lenovo Legion 5 15ARH05 2026-07-17 17:41:15 -04:00
drm_vblank_helper.h drm: Rename struct drm_atomic_state to drm_atomic_commit 2026-05-04 14:05:04 +10:00
drm_vblank_work.h
drm_vblank.h drm/vblank: add return value to drm_crtc_wait_one_vblank() 2025-12-11 16:55:36 +02:00
drm_vma_manager.h
drm_writeback.h
gpu_scheduler.h Linux 7.2 2026-08-20 10:58:44 +10:00
gud.h
Makefile kbuild: Let kernel-doc.py use PYTHON3 override 2025-11-08 19:42:22 -07:00
spsc_queue.h
task_barrier.h