mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Steven Price <steven.price@arm.com>
To: Osama Abdelkader <osama.abdelkader@gmail.com>,
	Boris Brezillon <boris.brezillon@collabora.com>,
	Liviu Dudau <liviu.dudau@arm.com>,
	Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Maxime Ripard <mripard@kernel.org>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>,
	Heiko Stuebner <heiko@sntech.de>,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Cc: stable@vger.kernel.org
Subject: Re: [PATCH] drm/panthor: harden firmware build-info bounds checks
Date: Wed, 29 Jul 2026 15:52:19 +0100	[thread overview]
Message-ID: <f1ba920e-a5a8-4e70-a107-297ac3b6bfd1@arm.com> (raw)
In-Reply-To: <20260720113212.11981-1-osama.abdelkader@gmail.com>

On 20/07/2026 12:32, Osama Abdelkader wrote:
> panthor_fw_read_build_info() checks whether the metadata range fits in the
> firmware image with hdr.meta_start + hdr.meta_size. Both fields are u32, so
> the addition can wrap and let an out-of-bounds range pass validation.
> 
> The function also reads the "git_sha: " prefix without first checking that
> the metadata is long enough, and meta_size == 0 can underflow the NULL
> terminator index.
> 
> Use subtraction-based bounds checking and reject metadata that is too short
> to contain the expected prefix and trailing NULL byte.
> 
> Fixes: 2718d91816ee ("drm/panthor: Add the FW logical block")
> Cc: stable@vger.kernel.org
> Signed-off-by: Osama Abdelkader <osama.abdelkader@gmail.com>

Reviewed-by: Steven Price <steven.price@arm.com>

I'll push this to drm-misc-fixes.

Thanks,
Steve

> ---
>  drivers/gpu/drm/panthor/panthor_fw.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/panthor/panthor_fw.c b/drivers/gpu/drm/panthor/panthor_fw.c
> index 6335893d3f16..9d0e1fafdce2 100644
> --- a/drivers/gpu/drm/panthor/panthor_fw.c
> +++ b/drivers/gpu/drm/panthor/panthor_fw.c
> @@ -709,7 +709,8 @@ static int panthor_fw_read_build_info(struct panthor_device *ptdev,
>  		return ret;
>  
>  	if (hdr.meta_start > fw->size ||
> -	    hdr.meta_start + hdr.meta_size > fw->size) {
> +	    hdr.meta_size > fw->size - hdr.meta_start ||
> +	    hdr.meta_size <= header_len) {
>  		drm_err(&ptdev->base, "Firmware build info corrupt\n");
>  		/* We don't need the build info, so continue */
>  		return 0;


      reply	other threads:[~2026-07-29 14:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-20 11:32 Osama Abdelkader
2026-07-29 14:52 ` Steven Price [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=f1ba920e-a5a8-4e70-a107-297ac3b6bfd1@arm.com \
    --to=steven.price@arm.com \
    --cc=airlied@gmail.com \
    --cc=boris.brezillon@collabora.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=heiko@sntech.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liviu.dudau@arm.com \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=osama.abdelkader@gmail.com \
    --cc=simona@ffwll.ch \
    --cc=stable@vger.kernel.org \
    --cc=tzimmermann@suse.de \
    /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

all inboxes | Powered by JetHome®