All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@intel.com>
To: "Kandpal, Suraj" <suraj.kandpal@intel.com>,
	"intel-gfx@lists.freedesktop.org"
	<intel-gfx@lists.freedesktop.org>,
	"intel-xe@lists.freedesktop.org" <intel-xe@lists.freedesktop.org>
Cc: "Hodo, Martin" <martin.hodo@intel.com>,
	"stable@vger.kernel.org" <stable@vger.kernel.org>,
	"Gupta, Anshuman" <anshuman.gupta@intel.com>
Subject: RE: [PATCH] drm/i915/hdcp: check streams[] bounds before overflow
Date: Mon, 29 Jun 2026 11:37:35 +0300	[thread overview]
Message-ID: <b7add5ab7a91e3a9aeb6843ece665334de80b6d8@intel.com> (raw)
In-Reply-To: <DS4PPFE901A304F58021028E7F8F29EE9C7E3EA2@DS4PPFE901A304F.namprd11.prod.outlook.com>

On Sat, 27 Jun 2026, "Kandpal, Suraj" <suraj.kandpal@intel.com> wrote:
>> Subject: [PATCH] drm/i915/hdcp: check streams[] bounds before overflow
>> 
>> The data->streams[] overflow check is done after the buffer overflow has
>> already happened. Move the overflow check before the write.
>> 
>> Side note, emitting a warning splat with a backtrace might be overkill here, but
>> prefer not changing the behaviour other than not doing the overrun.
>> 
>> Discovered using AI-assisted static analysis confirmed by Intel Product Security.
>> 
>> Reported-by: Martin Hodo <martin.hodo@intel.com>
>> Fixes: e03187e12cae ("drm/i915/hdcp: MST streams support in hdcp
>> port_data")
>> Cc: <stable@vger.kernel.org> # v5.12+
>> Cc: Anshuman Gupta <anshuman.gupta@intel.com>
>> Cc: Suraj Kandpal <suraj.kandpal@intel.com>
>> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
>
> LGTM,
> Reviewed-by: Suraj Kandpal <suraj.kandpal@intel.com>

Thanks for the review, pushed to din.

BR,
Jani.


>
>> ---
>>  drivers/gpu/drm/i915/display/intel_hdcp.c | 5 ++++-
>>  1 file changed, 4 insertions(+), 1 deletion(-)
>> 
>> diff --git a/drivers/gpu/drm/i915/display/intel_hdcp.c
>> b/drivers/gpu/drm/i915/display/intel_hdcp.c
>> index e88fec24af49..521786a75c42 100644
>> --- a/drivers/gpu/drm/i915/display/intel_hdcp.c
>> +++ b/drivers/gpu/drm/i915/display/intel_hdcp.c
>> @@ -145,6 +145,9 @@ 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)))
>> +			return -EINVAL;
>> +
>>  		data->streams[data->k].stream_id =
>>  			intel_conn_to_vcpi(state, connector);
>>  		data->k++;
>> @@ -155,7 +158,7 @@ intel_hdcp_required_content_stream(struct
>> intel_atomic_state *state,
>>  	}
>>  	drm_connector_list_iter_end(&conn_iter);
>> 
>> -	if (drm_WARN_ON(display->drm, data->k > INTEL_NUM_PIPES(display)
>> || data->k == 0))
>> +	if (drm_WARN_ON(display->drm, !data->k))
>>  		return -EINVAL;
>> 
>>  	/*
>> --
>> 2.47.3
>

-- 
Jani Nikula, Intel

      reply	other threads:[~2026-06-29  8:37 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-25 17:03 [PATCH] drm/i915/hdcp: check streams[] bounds before overflow Jani Nikula
2026-06-25 17:11 ` ✗ CI.checkpatch: warning for " Patchwork
2026-06-25 17:13 ` ✓ CI.KUnit: success " Patchwork
2026-06-25 18:00 ` ✓ Xe.CI.BAT: " Patchwork
2026-06-25 20:54 ` ✓ i915.CI.BAT: " Patchwork
2026-06-25 22:09 ` ✗ Xe.CI.FULL: failure " Patchwork
2026-06-26  4:53 ` ✗ i915.CI.Full: " Patchwork
2026-06-27  3:59 ` [PATCH] " Kandpal, Suraj
2026-06-29  8:37   ` Jani Nikula [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=b7add5ab7a91e3a9aeb6843ece665334de80b6d8@intel.com \
    --to=jani.nikula@intel.com \
    --cc=anshuman.gupta@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=martin.hodo@intel.com \
    --cc=stable@vger.kernel.org \
    --cc=suraj.kandpal@intel.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 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.