From: sashiko-bot@kernel.org
To: "Maxime Ripard" <mripard@kernel.org>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v10 8/9] drm/atomic-uapi: Add DRM_MODE_ATOMIC_RESET flag
Date: Thu, 12 Nov 2026 16:54:55 +0000 [thread overview]
Message-ID: <sashiko-outbox-211548@kernel.org> (raw)
In-Reply-To: <20261112-drm-reset-state-flag-v10-8-cefaa1ed056d@kernel.org>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] drm/atomic: lease revocation race in
drm_atomic_commit_fill_with_defaults()
--
commit b8c56650ab4657eb654cfbc63cf4622958dcbfc9
Author: Sebastian Wick <sebastian.wick@redhat.com>
drm/atomic-uapi: Add DRM_MODE_ATOMIC_RESET flag
This commit introduces the DRM_MODE_ATOMIC_RESET flag and the
DRM_CAP_ATOMIC_RESET capability to reset all KMS object states to their
defaults before applying the properties supplied in an atomic commit.
> diff --git a/drivers/gpu/drm/drm_atomic_uapi.c b/drivers/gpu/drm/drm_atomic_uapi.c
> index 1eebcf6f5e05b..fe6d8cc533bc9 100644
> --- a/drivers/gpu/drm/drm_atomic_uapi.c
> +++ b/drivers/gpu/drm/drm_atomic_uapi.c
[ ... ]
> @@ -1688,6 +1715,17 @@ int drm_mode_atomic_ioctl(struct drm_device *dev,
> fence_state = NULL;
> num_fences = 0;
>
> + if (arg->flags & DRM_MODE_ATOMIC_RESET) {
> + if (!drm_atomic_implements_create_state(dev)) {
> + ret = -EOPNOTSUPP;
> + goto out;
> + }
> +
> + ret = drm_atomic_commit_fill_with_defaults(file_priv, state);
> + if (ret)
> + goto out;
> + }
[Severity: Medium]
Can concurrent lease revocation during drm_atomic_commit_fill_with_defaults()
populate a partial pipeline into state and cause a NULL pointer dereference in
crtc_or_fake_commit()?
Each drm_lease_held() call in drm_atomic_commit_fill_with_defaults() acquires
and drops dev->mode_config.idr_mutex on its own, while _drm_lease_revoke()
empties master->leases under idr_mutex without taking modeset locks. If a
lessor revokes the lease between the plane loop and the CRTC loop, an active
plane is added to the commit with a reset state (new_plane_state->crtc == NULL,
old_plane_state->crtc == crtc) without adding its CRTC:
CPU0 (lessee) CPU1 (lessor)
drm_mode_atomic_ioctl()
drm_atomic_commit_fill_with_defaults()
drm_for_each_plane()
drm_lease_held(..., plane) -> true
drm_lease_held(..., crtc) -> true
drm_atomic_commit_set_plane_state()
drm_mode_revoke_lease_ioctl()
_drm_lease_revoke()
idr_destroy(&master->leases)
drm_for_each_crtc()
drm_lease_held(..., crtc) -> false
drm_for_each_connector_iter()
drm_lease_held(...) -> false
drm_atomic_commit()
...
drm_atomic_helper_plane_changed()
crtc_state = drm_atomic_get_new_crtc_state(state,
old_plane_state->crtc)
WARN_ON(!crtc_state)
...
drm_atomic_helper_setup_commit()
crtc_or_fake_commit(state, old_plane_state->crtc)
new_crtc_state = drm_atomic_get_new_crtc_state(state, crtc)
new_crtc_state->commit <-- NULL pointer dereference
Unlike drm_atomic_get_plane_state(), the plane loop in
drm_atomic_commit_fill_with_defaults() relies on the subsequent CRTC loop to
add old_plane_state->crtc to the commit, and the connector loop's -ENOENT
partial-pipeline guard is also bypassed once drm_lease_held() returns false for
the CRTC.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261112-drm-reset-state-flag-v10-0-cefaa1ed056d@kernel.org?part=8
next prev parent reply other threads:[~2026-11-12 16:55 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-12 16:31 [PATCH v10 0/9] drm: Add DRM_MODE_ATOMIC_RESET flag Maxime Ripard
2026-11-12 16:31 ` [PATCH v10 1/9] drm/amd/display: Fix planes atomic_create_state implementation Maxime Ripard
2026-11-12 16:31 ` [PATCH v10 2/9] drm/atomic: Add drm_atomic_implements_create_state() helper Maxime Ripard
2026-11-12 16:31 ` [PATCH v10 3/9] drm/atomic: Allow filling a commit with pristine object states Maxime Ripard
2026-11-12 17:16 ` sashiko-bot
2026-11-12 16:31 ` [PATCH v10 4/9] drm/tests: atomic: Add tests for drm_atomic_commit_fill_with_defaults() Maxime Ripard
2026-11-12 16:31 ` [PATCH v10 5/9] drm/amd/display: Take over the current stream and dc_state Maxime Ripard
2026-11-12 16:31 ` [PATCH v10 6/9] drm/vc4: Carry the HVS channel over to created CRTC states Maxime Ripard
2026-11-12 16:31 ` [PATCH v10 7/9] drm/msm/dpu1: Carry the mixers " Maxime Ripard
2026-11-12 16:31 ` [PATCH v10 8/9] drm/atomic-uapi: Add DRM_MODE_ATOMIC_RESET flag Maxime Ripard
2026-11-12 16:54 ` sashiko-bot [this message]
2026-11-12 16:31 ` [PATCH v10 9/9] drm/vkms: Add driver-specific plane property for testing Maxime Ripard
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-211548@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dri-devel@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.