[PATCH v3 0/3] drm/atomic: restrict the size of of gamma / degamma LUTs

Dmitry Baryshkov posted 3 patches 1 month ago
.../drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c    | 18 ++++++------
drivers/gpu/drm/drm_atomic_uapi.c                  | 32 ++++++++++++++++------
drivers/gpu/drm/drm_mode_object.c                  | 25 +++++++++++++++++
drivers/gpu/drm/drm_property.c                     | 11 ++++++++
include/drm/drm_mode_object.h                      |  3 ++
include/drm/drm_property.h                         |  1 +
6 files changed, 73 insertions(+), 17 deletions(-)
[PATCH v3 0/3] drm/atomic: restrict the size of of gamma / degamma LUTs
Posted by Dmitry Baryshkov 1 month ago
While picking up the Gamma correction patch for the msm driver I noticed
that kms_color@invalid-gamma-lut-sizes and
kms_color@invalid-degamma-lut-sizes tests fail. These tests attempt
submitting LUT tables greater than the size specified by the
corresponding property. The issue doesn't seem to be specific to msm
driver only. Add generic check that LUT size is not greater than the
size passed to drm_crtc_enable_color_mgmt().

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
---
Changes in v3:
- Fixed elem_size type (LKP)
- Link to v2: https://lore.kernel.org/r/20251228-drm-fix-lut-checks-v2-0-50f5d1a260a7@oss.qualcomm.com

Changes in v2:
- Fixed comments for drm_object_immutable_property_get_value(), changed
  it to use drm_WARN_ON (Thomas)
- Reordered arguments of drm_property_replace_blob_from_id(), moving
  max_size before expected_size (Thomas)
- Link to v1: https://lore.kernel.org/r/20251115-drm-fix-lut-checks-v1-0-3586f5855bc7@oss.qualcomm.com,
  resent at https://lore.kernel.org/all/20251210-drm-fix-lut-checks-v1-0-10ae38519f43@oss.qualcomm.com/

---
Dmitry Baryshkov (3):
      drm/mode_object: add drm_object_immutable_property_get_value()
      drm/atomic: add max_size check to drm_property_replace_blob_from_id()
      drm/atomic: verify that gamma/degamma LUTs are not too big

 .../drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c    | 18 ++++++------
 drivers/gpu/drm/drm_atomic_uapi.c                  | 32 ++++++++++++++++------
 drivers/gpu/drm/drm_mode_object.c                  | 25 +++++++++++++++++
 drivers/gpu/drm/drm_property.c                     | 11 ++++++++
 include/drm/drm_mode_object.h                      |  3 ++
 include/drm/drm_property.h                         |  1 +
 6 files changed, 73 insertions(+), 17 deletions(-)
---
base-commit: 349d4efadc1f831ebc0b872ba1e3a2b7dd58b72b
change-id: 20251114-drm-fix-lut-checks-4bb325e24110

Best regards,
-- 
With best wishes
Dmitry
Re: [PATCH v3 0/3] drm/atomic: restrict the size of of gamma / degamma LUTs
Posted by Dmitry Baryshkov 3 weeks, 4 days ago
On Tue, 06 Jan 2026 05:09:54 +0200, Dmitry Baryshkov wrote:
> While picking up the Gamma correction patch for the msm driver I noticed
> that kms_color@invalid-gamma-lut-sizes and
> kms_color@invalid-degamma-lut-sizes tests fail. These tests attempt
> submitting LUT tables greater than the size specified by the
> corresponding property. The issue doesn't seem to be specific to msm
> driver only. Add generic check that LUT size is not greater than the
> size passed to drm_crtc_enable_color_mgmt().
> 
> [...]

Applied to drm-misc-next, thanks!

[1/3] drm/mode_object: add drm_object_immutable_property_get_value()
      commit: 66c9c0cfe765af7f30eac880da0fa047aea8617d
[2/3] drm/atomic: add max_size check to drm_property_replace_blob_from_id()
      commit: ca59e33f5a1f642d13ae0e558fdbdd9aaa9fe203
[3/3] drm/atomic: verify that gamma/degamma LUTs are not too big
      commit: cea6e6e8717e81de266aa496f44088b2b960aa32

Best regards,
-- 
With best wishes
Dmitry