mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Thomas Zimmermann <tzimmermann@suse.de>
To: "Dmitry Baryshkov" <dmitry.baryshkov@oss.qualcomm.com>,
	"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
	"Maxime Ripard" <mripard@kernel.org>,
	"David Airlie" <airlied@gmail.com>,
	"Simona Vetter" <simona@ffwll.ch>,
	"Harry Wentland" <harry.wentland@amd.com>,
	"Leo Li" <sunpeng.li@amd.com>,
	"Rodrigo Siqueira" <siqueira@igalia.com>,
	"Alex Deucher" <alexander.deucher@amd.com>,
	"Christian König" <christian.koenig@amd.com>
Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	amd-gfx@lists.freedesktop.org
Subject: Re: [PATCH v3 3/3] drm/atomic: verify that gamma/degamma LUTs are not too big
Date: Tue, 6 Jan 2026 08:25:46 +0100	[thread overview]
Message-ID: <f44ca674-775c-4e48-ab7c-9adb7881ff70@suse.de> (raw)
In-Reply-To: <20260106-drm-fix-lut-checks-v3-3-f7f979eb73c8@oss.qualcomm.com>



Am 06.01.26 um 04:09 schrieb Dmitry Baryshkov:
> The kernel specifies LUT table sizes in a separate property, however it
> doesn't enforce it as a maximum. Some drivers implement max suze check

s/suze/size

> on their own in the atomic_check path. Other drivers simply ignore the
> issue. Perform LUT size validation in the generic place.
>
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>

Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>

> ---
>   drivers/gpu/drm/drm_atomic_uapi.c | 22 ++++++++++++++++++++--
>   1 file changed, 20 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_atomic_uapi.c b/drivers/gpu/drm/drm_atomic_uapi.c
> index dff1fdefcbeb..dc013a22bf26 100644
> --- a/drivers/gpu/drm/drm_atomic_uapi.c
> +++ b/drivers/gpu/drm/drm_atomic_uapi.c
> @@ -413,10 +413,19 @@ static int drm_atomic_crtc_set_property(struct drm_crtc *crtc,
>   	} else if (property == config->prop_vrr_enabled) {
>   		state->vrr_enabled = val;
>   	} else if (property == config->degamma_lut_property) {
> +		const size_t elem_size = sizeof(struct drm_color_lut);
> +		u64 lut_size;
> +
> +		ret = drm_object_immutable_property_get_value(&crtc->base,
> +							      config->degamma_lut_size_property,
> +							      &lut_size);
> +		if (ret)
> +			return ret;
> +
>   		ret = drm_property_replace_blob_from_id(dev,
>   					&state->degamma_lut,
>   					val,
> -					-1, -1, sizeof(struct drm_color_lut),
> +					elem_size * lut_size, -1, elem_size,
>   					&replaced);
>   		state->color_mgmt_changed |= replaced;
>   		return ret;
> @@ -429,10 +438,19 @@ static int drm_atomic_crtc_set_property(struct drm_crtc *crtc,
>   		state->color_mgmt_changed |= replaced;
>   		return ret;
>   	} else if (property == config->gamma_lut_property) {
> +		const size_t elem_size = sizeof(struct drm_color_lut);
> +		u64 lut_size;
> +
> +		ret = drm_object_immutable_property_get_value(&crtc->base,
> +							      config->gamma_lut_size_property,
> +							      &lut_size);
> +		if (ret)
> +			return ret;
> +
>   		ret = drm_property_replace_blob_from_id(dev,
>   					&state->gamma_lut,
>   					val,
> -					-1, -1, sizeof(struct drm_color_lut),
> +					elem_size * lut_size, -1, elem_size,
>   					&replaced);
>   		state->color_mgmt_changed |= replaced;
>   		return ret;
>

-- 
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstr. 146, 90461 Nürnberg, Germany, www.suse.com
GF: Jochen Jaser, Andrew McDonald, Werner Knoblich, (HRB 36809, AG Nürnberg)



  reply	other threads:[~2026-01-06  7:25 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-06  3:09 [PATCH v3 0/3] drm/atomic: restrict the size of of gamma / degamma LUTs Dmitry Baryshkov
2026-01-06  3:09 ` [PATCH v3 1/3] drm/mode_object: add drm_object_immutable_property_get_value() Dmitry Baryshkov
2026-01-06  7:24   ` Thomas Zimmermann
2026-01-06  3:09 ` [PATCH v3 2/3] drm/atomic: add max_size check to drm_property_replace_blob_from_id() Dmitry Baryshkov
2026-01-06  7:24   ` Thomas Zimmermann
2026-01-06  3:09 ` [PATCH v3 3/3] drm/atomic: verify that gamma/degamma LUTs are not too big Dmitry Baryshkov
2026-01-06  7:25   ` Thomas Zimmermann [this message]
2026-01-14  0:19 ` [PATCH v3 0/3] drm/atomic: restrict the size of of gamma / degamma LUTs Dmitry Baryshkov

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=f44ca674-775c-4e48-ab7c-9adb7881ff70@suse.de \
    --to=tzimmermann@suse.de \
    --cc=airlied@gmail.com \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=christian.koenig@amd.com \
    --cc=dmitry.baryshkov@oss.qualcomm.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=harry.wentland@amd.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=simona@ffwll.ch \
    --cc=siqueira@igalia.com \
    --cc=sunpeng.li@amd.com \
    /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

all inboxes | Powered by JetHome®