Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Maxime Ripard" <mripard@kernel.org>
Cc: intel-xe@lists.freedesktop.org, intel-gfx@lists.freedesktop.org,
	dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 4/6] drm/i915: Implement plane atomic_create_state
Date: Tue, 24 Nov 2026 11:19:58 +0000	[thread overview]
Message-ID: <sashiko-outbox-231037@kernel.org> (raw)
In-Reply-To: <20261124-drm-i915-conversion-state-readout-v1-4-b7132f72644d@kernel.org>

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 <mripard@kernel.org>

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-b7132f72644d@kernel.org?part=4

  reply	other threads:[~2026-11-24 11:20 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-24 10:59 [PATCH 0/6] drm/i915: Support DRM_MODE_ATOMIC_RESET Maxime Ripard
2026-11-24 10:59 ` [PATCH 1/6] drm/atomic-state-helper: Provide more STATE_CHECK_* variants Maxime Ripard
2026-11-24 10:59 ` [PATCH 2/6] drm/i915: Use the STATE_CHECK_* macros in the pipe config comparison Maxime Ripard
2026-11-24 11:23   ` Jani Nikula
2026-11-24 10:59 ` [PATCH 3/6] drm/i915: Implement CRTC atomic_create_state Maxime Ripard
2026-11-24 11:26   ` sashiko-bot
2026-11-24 10:59 ` [PATCH 4/6] drm/i915: Implement plane atomic_create_state Maxime Ripard
2026-11-24 11:19   ` sashiko-bot [this message]
2026-11-24 10:59 ` [PATCH 5/6] drm/i915: Implement connector atomic_create_state Maxime Ripard
2026-11-24 11:21   ` sashiko-bot
2026-11-24 10:59 ` [PATCH 6/6] drm/i915: Carry the current state over created states Maxime Ripard
2026-11-24 11:40   ` sashiko-bot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=sashiko-outbox-231037@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=mripard@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox