From: sashiko-bot@kernel.org
To: "Maxime Ripard" <mripard@kernel.org>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH RFC v2 9/9] drm/atomic-uapi: Add DRM_MODE_ATOMIC_RESET flag
Date: Wed, 12 Aug 2026 13:24:03 +0000 [thread overview]
Message-ID: <20260812132403.8FBFC1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260812-drm-reset-state-flag-v2-9-e96ce13317dd@kernel.org>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] drm_atomic_commit_fill_with_defaults() accesses colorop state without acquiring the required plane mutex, causing a lock assertion failure and data race.
--
--- Patch [9]: [PATCH RFC v2 9/9] drm/atomic-uapi: Add DRM_MODE_ATOMIC_RESET flag ---
commit 8b754afef124bddf6efaa487526713fc14275d85
Author: Sebastian Wick <sebastian.wick@redhat.com>
Subject: drm/atomic-uapi: Add DRM_MODE_ATOMIC_RESET flag
This commit introduces the DRM_MODE_ATOMIC_RESET flag for the atomic ioctl.
It allows userspace to reset all KMS object states to their defaults before
applying property changes.
> diff --git a/drivers/gpu/drm/drm_atomic_uapi.c b/drivers/gpu/drm/drm_atomic_uapi.c
> index 1050dddadb17e..cdcc6efb9a00f 100644
> --- a/drivers/gpu/drm/drm_atomic_uapi.c
> +++ b/drivers/gpu/drm/drm_atomic_uapi.c
> @@ -1675,6 +1682,12 @@ int drm_mode_atomic_ioctl(struct drm_device *dev,
> fence_state = NULL;
> num_fences = 0;
>
> + if (arg->flags & DRM_MODE_ATOMIC_RESET) {
> + ret = drm_atomic_commit_fill_with_defaults(state);
[Severity: High]
Does calling drm_atomic_commit_fill_with_defaults() here trigger a lock
assertion failure and potential data race for colorops?
Looking at drm_atomic_commit_fill_with_defaults() in drm_atomic.c, the loop
iterating over colorops asserts that the plane's mutex is held, but never
acquires it:
drm_for_each_colorop(colorop, dev) {
...
drm_modeset_lock_assert_held(&colorop->plane->mutex);
ret = drm_atomic_commit_set_colorop_state(commit, colorop,
colorop_state);
...
}
The subsequent loops for planes, CRTCs, and connectors in the same function
correctly call drm_modeset_lock() before operating on their respective
objects.
Since the plane mutex is neither held prior to calling
drm_atomic_commit_fill_with_defaults() nor acquired inside the colorop loop,
could this lead to state corruption or a use-after-free during concurrent
atomic commits?
> + if (ret)
> + goto out;
> + }
> +
> for (i = 0; i < arg->count_objs; i++) {
> uint32_t obj_id, count_props;
> struct drm_mode_object *obj;
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260812-drm-reset-state-flag-v2-0-e96ce13317dd@kernel.org?part=9
prev parent reply other threads:[~2026-08-12 13:24 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-12 12:56 [PATCH RFC v2 0/9] drm: Add DRM_MODE_ATOMIC_RESET flag Maxime Ripard
2026-08-12 12:56 ` [PATCH RFC v2 1/9] drm/atomic: colorop: Rename state to state_to_destroy Maxime Ripard
2026-08-12 12:56 ` [PATCH RFC v2 2/9] drm/atomic: Create function to insert CRTC state into a commit Maxime Ripard
2026-08-12 12:56 ` [PATCH RFC v2 3/9] drm/atomic: Create function to insert plane " Maxime Ripard
2026-08-12 12:56 ` [PATCH RFC v2 4/9] drm/atomic: Create function to insert colorop " Maxime Ripard
2026-08-12 12:57 ` [PATCH RFC v2 5/9] drm/atomic: Create function to insert private obj " Maxime Ripard
2026-08-12 12:57 ` [PATCH RFC v2 6/9] drm/atomic: Create function to insert connector " Maxime Ripard
2026-08-12 12:57 ` [PATCH RFC v2 7/9] drm/atomic: Add drm_atomic_can_create_state() helper Maxime Ripard
2026-08-12 12:57 ` [PATCH RFC v2 8/9] drm/atomic: Allow filling a commit with pristine object states Maxime Ripard
2026-08-12 13:18 ` sashiko-bot
2026-08-12 12:57 ` [PATCH RFC v2 9/9] drm/atomic-uapi: Add DRM_MODE_ATOMIC_RESET flag Maxime Ripard
2026-08-12 13:24 ` sashiko-bot [this message]
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=20260812132403.8FBFC1F000E9@smtp.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.