All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
To: Jesus Narvaez <jesus.narvaez@intel.com>,
	<intel-gfx@lists.freedesktop.org>
Cc: Martin Hodo <martin.hodo@intel.com>,
	Alan Previn <alan.previn.teres.alexis@intel.com>,
	<stable@vger.kernel.org>
Subject: Re: [PATCH 1/2] drm/i915/huc: Validate the CPD entry offset before manifest read
Date: Mon, 24 Aug 2026 19:09:33 -0700	[thread overview]
Message-ID: <5e9a52d3-97d1-4ec3-b0ce-d2d411a0dba0@intel.com> (raw)
In-Reply-To: <20260807192301.3009387-3-jesus.narvaez@intel.com>



On 8/7/2026 12:23 PM, Jesus Narvaez wrote:
> The CPD manifest offset was dereferenced without checking whether the
> offset was out of bounds or not. Validate the offset is within the FW
> blob before continuing with the read.
>
> Discovered using AI-assisted static analysis confirmed by Intel Product
> Security.
>
> Reported-by: Martin Hodo <martin.hodo@intel.com>
> Fixes: 93a575ab1533 ("drm/i915/huc: Parse the GSC-enabled HuC binary")
> Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
> Cc: Alan Previn <alan.previn.teres.alexis@intel.com>
> Cc: <stable@vger.kernel.org> # v6.5+
> Signed-off-by: Jesus Narvaez <jesus.narvaez@intel.com>
> ---
>   drivers/gpu/drm/i915/gt/uc/intel_huc_fw.c | 14 ++++++++++++--
>   1 file changed, 12 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/gt/uc/intel_huc_fw.c b/drivers/gpu/drm/i915/gt/uc/intel_huc_fw.c
> index b648238cc675..b9cbcf973236 100644
> --- a/drivers/gpu/drm/i915/gt/uc/intel_huc_fw.c
> +++ b/drivers/gpu/drm/i915/gt/uc/intel_huc_fw.c
> @@ -216,9 +216,19 @@ int intel_huc_fw_get_binary_info(struct intel_uc_fw *huc_fw, const void *data, s
>   	entry = data + header->header_length;
>   
>   	for (i = 0; i < header->num_of_entries; i++, entry++) {
> -		if (strcmp(entry->name, "HUCP.man") == 0)
> +		if (strcmp(entry->name, "HUCP.man") == 0) {
> +			u32 offset = entry_offset(entry);
> +
> +			if (offset >= size ||
> +			    size - offset < sizeof(struct intel_gsc_manifest_header)) {

IMO this could use some parenthesis to clear up the ordering of operations.
with that:

Reviewed-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>

> +				huc_err(huc, "CPD manifest offset 0x%x out of bounds (size %zu)\n",
> +					offset, size);
> +				return -ENODATA;
> +			}
> +
>   			intel_uc_fw_version_from_gsc_manifest(&huc_fw->file_selected.ver,
> -							      data + entry_offset(entry));
> +							      data + offset);
> +		}
>   
>   		if (strcmp(entry->name, "huc_fw") == 0) {
>   			u32 offset = entry_offset(entry);


      parent reply	other threads:[~2026-08-25  2:09 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-07 19:23 [PATCH 1/2] drm/i915/huc: Validate the CPD entry offset before manifest read Jesus Narvaez
2026-08-07 19:23 ` [PATCH 2/2] drm/i915/gsc: " Jesus Narvaez
2026-08-25  2:28   ` Daniele Ceraolo Spurio
2026-09-11 15:53     ` Narvaez, Jesus
2026-09-13 12:22       ` Daniele Ceraolo Spurio
2026-08-08  4:14 ` ✓ i915.CI.BAT: success for series starting with [1/2] drm/i915/huc: " Patchwork
2026-08-08  6:31 ` ✗ i915.CI.Full: failure " Patchwork
2026-08-25  2:09 ` Daniele Ceraolo Spurio [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=5e9a52d3-97d1-4ec3-b0ce-d2d411a0dba0@intel.com \
    --to=daniele.ceraolospurio@intel.com \
    --cc=alan.previn.teres.alexis@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jesus.narvaez@intel.com \
    --cc=martin.hodo@intel.com \
    --cc=stable@vger.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 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.