From: sashiko-bot@kernel.org
To: "John Harrison" <John.Harrison@Igalia.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [RFC PATCH 7/8] drm/colorop: Convert pipline 'next' pointer to a list
Date: Tue, 09 Jun 2026 17:40:36 +0000 [thread overview]
Message-ID: <20260609174037.1C7C21F00893@smtp.kernel.org> (raw)
In-Reply-To: <20260609171941.169104-8-John.Harrison@Igalia.com>
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
New issues:
- [High] Unconditional dereference of potentially NULL color pipeline in VKMS pre_blend_color_transform.
- [Medium] Fragile global state tracking in `drm_atomic_colorop_print_state` leads to misaligned pointer dereferences.
Pre-existing issues:
- [Critical] Data race and Use-After-Free due to asynchronous access of global `colorop->state` in VKMS composer.
--
commit bddf98b16d8f020be8f44f0de1ce3cd9f1f44d2d
Author: John Harrison <John.Harrison@Igalia.com>
drm/colorop: Convert pipline 'next' pointer to a list
The colorop pipeline system was using explicit next pointers and open
coded lists rather than the official kernel list helpers. Fix that.
> diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
> index 170de30c28ae4..8e985fd0562be 100644
> --- a/drivers/gpu/drm/drm_atomic.c
> +++ b/drivers/gpu/drm/drm_atomic.c
[ ... ]
> @@ -849,7 +853,12 @@ static void drm_atomic_colorop_print_state(struct drm_printer *p,
> break;
> }
>
> - drm_printf_indent(p, 1, "next=%d\n", colorop->next ? colorop->next->base.id : 0);
> + if (list_is_last(&colorop->pipeline_list, &(*pipeline)->pipeline_head)) {
> + *pipeline = NULL;
> + return;
> + }
> +
> + drm_printf_indent(p, 1, "next=%d\n", list_next_entry(colorop, pipeline_list)->base.id);
> }
[Severity: Medium]
What happens if an orphaned colorop (created but not added to any pipeline)
exists in the global config->colorop_list?
It appears the pipeline pointer would be set to this orphan, but list_is_last
will never evaluate to true since its pipeline_head is empty. Won't the
pipeline tracking get permanently stuck, causing a subsequent valid pipeline's
last node to return false here?
This looks like it would evaluate list_next_entry which computes container_of
on pipeline_head at a different offset, leading to a misaligned pointer
dereference.
> diff --git a/drivers/gpu/drm/vkms/vkms_composer.c b/drivers/gpu/drm/vkms/vkms_composer.c
> index 83d217085ad09..fc20b788738a3 100644
> --- a/drivers/gpu/drm/vkms/vkms_composer.c
> +++ b/drivers/gpu/drm/vkms/vkms_composer.c
> @@ -194,9 +194,12 @@ static void pre_blend_color_transform(const struct vkms_plane_state *plane_state
> struct line_buffer *output_buffer)
> {
> struct pixel_argb_s32 pixel;
> + struct drm_colorop *pipeline = plane_state->base.base.color_pipeline;
> +
> + WARN_ON(!list_is_first(&pipeline->pipeline_list, &pipeline->pipeline_head));
[Severity: High]
Could this cause a regression if userspace doesn't configure a color pipeline
and leaves the property unset?
The previous code handled a missing pipeline safely, but this looks like it
will unconditionally dereference the pipeline pointer inside the list_is_first
helper before checking if it actually exists. Does this need an early return
or a valid pipeline check first?
>
> for (size_t x = 0; x < output_buffer->n_pixels; x++) {
> - struct drm_colorop *colorop = plane_state->base.base.color_pipeline;
> + struct drm_colorop *colorop;
>
> /*
[ ... ]
> @@ -213,7 +216,7 @@ static void pre_blend_color_transform(const struct vkms_plane_state *plane_state
> pixel.g = output_buffer->pixels[x].g;
> pixel.b = output_buffer->pixels[x].b;
>
> - while (colorop) {
> + list_for_each_entry(colorop, &pipeline->pipeline_head, pipeline_list) {
> struct drm_colorop_state *colorop_state;
>
> colorop_state = colorop->state;
[Severity: Critical]
This is a pre-existing issue, but can this direct access to colorop->state
race with concurrent atomic commits?
Since vkms_composer_worker runs asynchronously, couldn't a modeset dynamically
free this state via drm_atomic_helper_commit_cleanup_done while we're reading
it, resulting in a use-after-free regression?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260609171941.169104-1-John.Harrison@Igalia.com?part=7
next prev parent reply other threads:[~2026-06-09 17:40 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-09 17:19 [RFC PATCH 0/8] Convert colorop pipelines to use proper lists John Harrison
2026-06-09 17:19 ` [RFC PATCH 1/8] drm/colorop: Reduce scope of colorop helpers John Harrison
2026-06-09 17:31 ` sashiko-bot
2026-06-09 17:19 ` [RFC PATCH 2/8] drm/colorop: Create pipelines via 'add to pipeline' instead of 'set next' John Harrison
2026-06-09 17:19 ` [RFC PATCH 3/8] drm/i915/colorop: Update to new pipeline API John Harrison
2026-06-09 17:32 ` sashiko-bot
2026-06-09 17:19 ` [RFC PATCH 4/8] drm/amd/colorop: " John Harrison
2026-06-09 17:37 ` sashiko-bot
2026-06-09 17:19 ` [RFC PATCH 5/8] drm/vkms/colorop: " John Harrison
2026-06-09 17:37 ` sashiko-bot
2026-06-09 17:19 ` [RFC PATCH 6/8] drm/colorop: Remove old add-next API as no longer used John Harrison
2026-06-09 17:19 ` [RFC PATCH 7/8] drm/colorop: Convert pipline 'next' pointer to a list John Harrison
2026-06-09 17:40 ` sashiko-bot [this message]
2026-06-09 17:19 ` [RFC PATCH 8/8] drm/colorop: Check that requested colorop is the root of a pipeline John Harrison
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=20260609174037.1C7C21F00893@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=John.Harrison@Igalia.com \
--cc=dri-devel@lists.freedesktop.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