Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Tzung-Bi Shih" <tzungbi@kernel.org>
Cc: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org,
	dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] drm/i915/hdcp: Call drm_connector_list_iter_end() on early return
Date: Tue, 01 Dec 2026 09:07:12 +0000	[thread overview]
Message-ID: <sashiko-outbox-242910@kernel.org> (raw)
In-Reply-To: <20261201085340.1471343-1-tzungbi@kernel.org>

Thank you for your contribution! Sashiko AI review found no new issues
in this patch, but noticed 1 related pre-existing issue it does not
introduce:
- [Critical] drm/i915/display: null pointer deref in
  intel_hdcp_required_content_stream() [1]
--

commit dc9e0e29bf2443e79a6b1bc4bcb651f3727d0798
Author: Tzung-Bi Shih <tzungbi@kernel.org>

drm/i915/hdcp: Call drm_connector_list_iter_end() on early return

This commit ensures drm_connector_list_iter_end() is called before
returning -EINVAL when the streams[] bounds check triggers in
intel_hdcp_required_content_stream().

> diff --git a/drivers/gpu/drm/i915/display/intel_hdcp.c b/drivers/gpu/drm/i915/display/intel_hdcp.c
> index dad0c854e4fa6..2c1ce65e7f9ad 100644
> --- a/drivers/gpu/drm/i915/display/intel_hdcp.c
> +++ b/drivers/gpu/drm/i915/display/intel_hdcp.c
> @@ -145,8 +145,10 @@ intel_hdcp_required_content_stream(struct intel_atomic_state *state,
>  		if (!new_conn_state || !new_conn_state->crtc)
>  			continue;
>  
> -		if (drm_WARN_ON(display->drm, data->k >= INTEL_NUM_PIPES(display)))
> +		if (drm_WARN_ON(display->drm, data->k >= INTEL_NUM_PIPES(display))) {
> +			drm_connector_list_iter_end(&conn_iter);
>  			return -EINVAL;
> +		}
>  
>  		data->streams[data->k].stream_id =
>  			intel_conn_to_vcpi(state, connector);

[Severity: Critical]
This problem wasn't introduced by this patch, but earlier in this loop in
intel_hdcp_required_content_stream(), can intel_encoder_is_mst() trigger a
NULL pointer dereference [1] when evaluating a connected but inactive
MST connector?

drivers/gpu/drm/i915/display/intel_hdcp.c:intel_hdcp_required_content_stream() {
	...
	for_each_intel_connector_iter(connector, &conn_iter) {
		if (connector->base.status == connector_status_disconnected)
			continue;

		if (!intel_encoder_is_mst(intel_attached_encoder(connector)))
			continue;
	...
}

An inactive connector in an MST topology has no attached encoder, so
intel_attached_encoder() returns NULL and intel_encoder_is_mst()
unconditionally dereferences encoder->type.

[1] https://sashiko.dev/#/bug/linux-e7eb43c9-05b7-4152-87a3-a523da195086

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261201085340.1471343-1-tzungbi@kernel.org?part=1

      parent reply	other threads:[~2026-12-01  9:07 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-01  8:53 [PATCH] drm/i915/hdcp: Call drm_connector_list_iter_end() on early return Tzung-Bi Shih
2026-12-01  9:04 ` ✓ CI.KUnit: success for " Patchwork
2026-12-01  9:07 ` sashiko-bot [this message]

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=sashiko-outbox-242910@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=tzungbi@kernel.org \
    /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