Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [High] drm/i915: UAF and VMA leak in drm_mode_config_reset() via atomic_create_state --
commit 464346083e71e6c63fc65d310b5b8531a2b40785 Author: Maxime Ripard <[email protected]> drm/i915: Implement plane atomic_create_state This commit adds intel_plane_create_state() and wires it up to .atomic_create_state on all i915/xe plane function tables. > diff --git a/drivers/gpu/drm/i915/display/i9xx_plane.c > b/drivers/gpu/drm/i915/display/i9xx_plane.c > index 0902b17d02693..bfaa74a669d34 100644 > --- a/drivers/gpu/drm/i915/display/i9xx_plane.c > +++ b/drivers/gpu/drm/i915/display/i9xx_plane.c > @@ -884,6 +884,7 @@ static const struct drm_plane_funcs i965_plane_funcs = { > .update_plane = drm_atomic_helper_update_plane, > .disable_plane = drm_atomic_helper_disable_plane, > .destroy = intel_plane_destroy, > + .atomic_create_state = intel_plane_create_state, > .atomic_duplicate_state = intel_plane_duplicate_state, > .atomic_destroy_state = intel_plane_destroy_state, > .format_mod_supported = i965_plane_format_mod_supported, [Severity: High] Can populating .atomic_create_state cause a use-after-free and double free of old_plane_state when drm_mode_config_reset() runs during D3cold resume? drm_mode_config_reset() is also a caller of .atomic_create_state: when a plane implements this hook, drm_mode_config_plane_reset_with_create_state() destroys the existing plane->state via .atomic_destroy_state() and replaces it with a newly allocated default state. In xe, xe_display_disable_d3cold() calls drm_mode_config_reset() on runtime PM resume from D3cold. When an atomic commit runs while the device is in D3cold, drm_atomic_get_plane_state() captures state->planes[i].old_state = plane->state before intel_atomic_commit() wakes the device via intel_display_rpm_get() -> xe_display_disable_d3cold() -> drm_mode_config_reset(). That reset frees plane->state while it is still referenced as old_plane_state, after which intel_atomic_prepare_commit() and intel_atomic_swap_state() read and swap the freed old_plane_state and queue it to be freed a second time. Even outside an atomic commit, exiting D3cold while a plane holds a pinned framebuffer on a DPMS-off CRTC destroys plane->state without calling intel_cleanup_plane_fb(), triggering the ggtt_vma/dpt_vma warnings in intel_plane_destroy_state(), leaking the pinned VMAs, and wiping the plane software state. -- Sashiko AI review · https://sashiko.dev/#/patchset/20261124-drm-i915-conversion-state-readout-v1-0-b7132f726...@kernel.org?part=4
