dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Melissa Wen" <mwen@igalia.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v9 2/4] drm/colorop: make lut(1/3)d_interpolation props correctly behave as mutable
Date: Tue, 09 Jun 2026 11:17:05 +0000	[thread overview]
Message-ID: <20260609111706.7079E1F0089F@smtp.kernel.org> (raw)
In-Reply-To: <20260609110420.1298352-3-mwen@igalia.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:

Pre-existing issues:
- [High] The function `drm_colorop_atomic_destroy_state` frees the `drm_colorop_state` struct without releasing the reference to the `state->data` blob, leading to a memory leak of `drm_property_blob` objects.
- [High] `__drm_atomic_helper_colorop_duplicate_state` unconditionally resets `bypass = true`, destroying user state.
--

commit af8aea1831e57bd16ec95c73773d4e52e3faa54a
Author: Melissa Wen <mwen@igalia.com>
Subject: drm/colorop: make lut(1/3)d_interpolation props correctly behave as mutable

This commit moves the interpolation properties into drm_colorop_state so
they can correctly behave as mutable properties. It updates the getters,
setters, and state printing to use the state objects instead of the base
colorop.

> diff --git a/drivers/gpu/drm/drm_colorop.c b/drivers/gpu/drm/drm_colorop.c
> index 44eb823585d2e..5ab77cf47f0a9 100644
> --- a/drivers/gpu/drm/drm_colorop.c
> +++ b/drivers/gpu/drm/drm_colorop.c
[ ... ]
> @@ -488,6 +486,20 @@ static void __drm_colorop_state_reset(struct drm_colorop_state *colorop_state,
>  						      &val);
>  		colorop_state->curve_1d_type = val;
>  	}
> +
> +	if (colorop->lut1d_interpolation_property) {
> +		if (!drm_object_property_get_default_value(&colorop->base,
> +							   colorop->lut1d_interpolation_property,
> +							   &val))
> +			colorop_state->lut1d_interpolation = val;
> +	}
> +
> +	if (colorop->lut3d_interpolation_property) {
> +		if (!drm_object_property_get_default_value(&colorop->base,
> +							   colorop->lut3d_interpolation_property,
> +							   &val))
> +			colorop_state->lut3d_interpolation = val;
> +	}
>  }

[Severity: High]
This isn't a bug introduced by this patch, but does 
drm_colorop_atomic_destroy_state() leak the state->data blob reference?

During atomic state duplication, a reference is taken on the data blob:

static void __drm_atomic_helper_colorop_duplicate_state(...)
{
        ...
        if (state->data)
                drm_property_blob_get(state->data);
        ...
}

However, the destruction function frees the state without dropping this
reference:

void drm_colorop_atomic_destroy_state(...)
{
        kfree(state);
}

Could this leak system memory on every atomic commit that includes the
colorop? Is it possible this also happens in drm_colorop_reset() when it
calls kfree() on colorop->state?

[Severity: High]
This is also a pre-existing issue, but does 
__drm_atomic_helper_colorop_duplicate_state() corrupt the user state by 
forcing bypass to true?

static void __drm_atomic_helper_colorop_duplicate_state(...)
{
        memcpy(state, colorop->state, sizeof(*state));
        ...
        state->bypass = true;
}

If userspace configures a color pipeline with bypass = false, will a
subsequent unrelated atomic commit (like moving a cursor or doing a pageflip)
that duplicates the colorop state inadvertently reset bypass back to true?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260609110420.1298352-1-mwen@igalia.com?part=2

  reply	other threads:[~2026-06-09 11:17 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-09 10:20 [PATCH v9 0/4] drm/atomic: track individual colorop updates Melissa Wen
2026-06-09 10:20 ` [PATCH v9 1/4] drm/colorop: Remove read-only comments from interpolation fields Melissa Wen
2026-06-09 10:20 ` [PATCH v9 2/4] drm/colorop: make lut(1/3)d_interpolation props correctly behave as mutable Melissa Wen
2026-06-09 11:17   ` sashiko-bot [this message]
2026-06-09 10:20 ` [PATCH v9 3/4] drm/atomic: track individual colorop updates Melissa Wen
2026-06-09 11:21   ` sashiko-bot
2026-06-09 10:20 ` [PATCH v9 4/4] drm/amd/display: use plane color_mgmt_changed to track colorop changes Melissa Wen
2026-06-09 11:17   ` 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=20260609111706.7079E1F0089F@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=mwen@igalia.com \
    --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