All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Chaitanya Kumar Borah" <chaitanya.kumar.borah@intel.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [CI v4 02/14] drm/i915/color: Add CSC on SDR plane color pipeline
Date: Mon, 13 Jul 2026 06:01:43 +0000	[thread overview]
Message-ID: <20260713060143.D36111F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260713051516.4087420-3-chaitanya.kumar.borah@intel.com>

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

New issues:
- [Medium] The newly added SDR plane color pipeline logic is completely unreachable due to an early return for non-HDR planes in the caller function.
- [Medium] The driver exposes the `CSC_FF` colorop but fails to extract and apply its atomic state, violating the DRM API contract.

Pre-existing issues:
- [Critical] `drm_colorop_cleanup()` fails to unregister the DRM mode object, leading to a Use-After-Free via stale object IDs.
- [High] `drm_colorop_cleanup` assumes `colorop->dev` and `colorop->head` are fully initialized, causing a NULL pointer dereference and crash on early initialization failures.
- [High] Unchecked return value from `kasprintf()` leads to a NULL pointer dereference during DRM property creation.
--

--- Patch [2]: [CI v4 02/14] drm/i915/color: Add CSC on SDR plane color pipeline ---
commit ed94f2ef5daa2b6a1fe43a799710d164ac1323d4
Author: Chaitanya Kumar Borah <chaitanya.kumar.borah@intel.com>

drm/i915/color: Add CSC on SDR plane color pipeline

Add the fixed-function CSC block to color pipeline in SDR planes
as a DRM_COLOROP_FIXED_MATRIX colorop.

> diff --git a/drivers/gpu/drm/i915/display/intel_color_pipeline.c b/drivers/gpu/drm/i915/display/intel_color_pipeline.c
> index 6cf8080ee8000..2ef42a133a987 100644
> --- a/drivers/gpu/drm/i915/display/intel_color_pipeline.c
> +++ b/drivers/gpu/drm/i915/display/intel_color_pipeline.c

[ ... ]

> @@ -92,6 +102,12 @@ struct intel_colorop *intel_color_pipeline_plane_add_colorop(struct drm_plane *p
>  							  DRM_COLOROP_LUT1D_INTERPOLATION_LINEAR,
>  							  DRM_COLOROP_FLAG_ALLOW_BYPASS);
>  		break;
> +	case INTEL_PLANE_CB_CSC_FF:
> +		ret = drm_plane_colorop_fixed_matrix_init(dev, &colorop->base, plane,
> +							  &intel_colorop_funcs,
> +							  intel_plane_supported_csc_ff,
> +							  DRM_COLOROP_FLAG_ALLOW_BYPASS);
> +		break;

[Severity: Medium]
Will intel_plane_color_copy_uapi_to_hw_state() successfully extract the
state for INTEL_PLANE_CB_CSC_FF?

Looking at intel_plane_colorop_replace_blob() in
drivers/gpu/drm/i915/display/intel_plane.c, it handles blob-based colorops
like INTEL_PLANE_CB_CSC, but lacks a case for INTEL_PLANE_CB_CSC_FF.

Could this cause userspace settings for fixed_matrix_type and bypass on this
colorop to be silently ignored when applying the pipeline?

[Severity: High]
This is a pre-existing issue, but if drm_plane_colorop_fixed_matrix_init()
or other initialization functions fail early (e.g. due to OOM), the code
jumps to the cleanup label in this function and calls intel_colorop_destroy().

This calls drm_colorop_cleanup(), which unconditionally dereferences
colorop->dev and colorop->head via list_del().

Since these fields might not be initialized on early failure, is it possible
for this to cause a NULL pointer dereference?

[Severity: Critical]
This is another pre-existing issue on the cleanup path. When
drm_colorop_cleanup() runs, it never calls drm_mode_object_unregister().

Because the object was registered in drm_mode_object_add() during init,
does omitting drm_mode_object_unregister() leave a dangling pointer in the
device's IDR, allowing userspace to trigger a use-after-free by querying
the freed object ID?

>  	default:
>  		drm_err(plane->dev, "Invalid colorop id [%d]", id);
>  		ret = -EINVAL;

[ ... ]

> @@ -126,9 +142,12 @@ int _intel_color_pipeline_plane_init(struct drm_plane *plane, struct drm_prop_en
>  	if (plane_has_3dlut(display, pipe, plane)) {
>  		pipeline = xe3plpd_primary_plane_pipeline;
>  		pipeline_len = ARRAY_SIZE(xe3plpd_primary_plane_pipeline);
> -	} else {
> +	} else if (icl_is_hdr_plane(display, to_intel_plane(plane)->id)) {
>  		pipeline = hdr_plane_pipeline;
>  		pipeline_len = ARRAY_SIZE(hdr_plane_pipeline);
> +	} else {
> +		pipeline = sdr_plane_pipeline;
> +		pipeline_len = ARRAY_SIZE(sdr_plane_pipeline);
>  	}

[Severity: Medium]
Will this newly added sdr_plane_pipeline ever execute?

The caller of this function, intel_color_pipeline_plane_init(), has an early
return:

intel_color_pipeline_plane_init()
    if (!icl_is_hdr_plane(display, to_intel_plane(plane)->id))
        return 0;
        
    ret = _intel_color_pipeline_plane_init(plane, &pipelines[len], pipe);

Because it skips all non-HDR planes before calling this function, doesn't
that make this else branch for SDR planes completely unreachable?

[Severity: High]
This isn't a bug introduced by this patch, but immediately below this block
in _intel_color_pipeline_plane_init(), kasprintf() is called:

    list->name = kasprintf(GFP_KERNEL, "Color Pipeline %d", ...);

The return value is not checked for NULL.

If kasprintf() fails, it passes the NULL pointer to
drm_plane_create_color_pipeline_property(), which passes it to
drm_property_create_enum().

Will this cause a panic when strlen(name) is called on the NULL pointer
inside drm_property_add_enum()?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260713051516.4087420-1-chaitanya.kumar.borah@intel.com?part=2

  reply	other threads:[~2026-07-13  6:01 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-13  5:15 [CI v4 00/14] drm/i915/color: Enable SDR plane color pipeline Chaitanya Kumar Borah
2026-07-13  5:15 ` [CI v4 01/14] drm/colorop: Add DRM_COLOROP_FIXED_MATRIX Chaitanya Kumar Borah
2026-07-13  5:48   ` sashiko-bot
2026-07-13  5:15 ` [CI v4 02/14] drm/i915/color: Add CSC on SDR plane color pipeline Chaitanya Kumar Borah
2026-07-13  6:01   ` sashiko-bot [this message]
2026-07-13  5:15 ` [CI v4 03/14] drm/i915/display: extract glk_plane_color_ctl_input_csc helper Chaitanya Kumar Borah
2026-07-13  5:15 ` [CI v4 04/14] drm/i915/display: simplify glk_plane_color_ctl_input_csc Chaitanya Kumar Borah
2026-07-13  5:15 ` [CI v4 05/14] drm/i915/display: Track CSC mode in intel plane state Chaitanya Kumar Borah
2026-07-13  5:59   ` sashiko-bot
2026-07-13  5:15 ` [CI v4 06/14] drm/i915/display: Program input CSC on SDR planes Chaitanya Kumar Borah
2026-07-13  6:01   ` sashiko-bot
2026-07-13  5:15 ` [CI v4 07/14] drm/i915/color: Add YCbCr limited-to-full range color block support Chaitanya Kumar Borah
2026-07-13  5:55   ` sashiko-bot
2026-07-13  5:15 ` [CI v4 08/14] drm/i915/color: Add YUV range correction to SDR plane pipeline Chaitanya Kumar Borah
2026-07-13  5:55   ` sashiko-bot
2026-07-13  5:15 ` [CI v4 09/14] drm/i915/color: Add support for 1D LUT in SDR planes Chaitanya Kumar Borah
2026-07-13  5:56   ` sashiko-bot
2026-07-13  5:15 ` [CI v4 10/14] drm/i915/color: Extract HDR pre-CSC LUT programming to helper function Chaitanya Kumar Borah
2026-07-13  5:15 ` [CI v4 11/14] drm/i915/color: Program Pre-CSC registers for SDR Chaitanya Kumar Borah
2026-07-13  5:15 ` [CI v4 12/14] drm/i915/color: Extract HDR post-CSC LUT programming to helper function Chaitanya Kumar Borah
2026-07-13  5:15 ` [CI v4 13/14] drm/i915/color: Program Plane Post CSC registers for SDR planes Chaitanya Kumar Borah
2026-07-13  6:05   ` sashiko-bot
2026-07-13  5:15 ` [CI v4 14/14] drm/i915/color: Add color pipeline support " Chaitanya Kumar Borah
2026-07-13  5:59   ` sashiko-bot
2026-07-13  5:50 ` ✓ CI.KUnit: success for drm/i915/color: Enable SDR plane color pipeline (rev5) Patchwork
2026-07-13  6:34 ` ✓ Xe.CI.BAT: " Patchwork
2026-07-13  6:51 ` ✓ i915.CI.BAT: " Patchwork
2026-07-13  8:29 ` ✗ Xe.CI.FULL: failure " Patchwork
2026-07-13 10:24 ` ✗ i915.CI.Full: " Patchwork

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=20260713060143.D36111F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=chaitanya.kumar.borah@intel.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 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.