Linux Input/HID development
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Zhang Jiaxi <Z1529105815@outlook.com>
Cc: Hans de Goede <hansg@kernel.org>,
	 "linux-input@vger.kernel.org" <linux-input@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [RFC PATCH] Input: goodix-berlin - validate the complete IC info misc block
Date: Thu, 12 Nov 2026 17:04:46 -0800	[thread overview]
Message-ID: <avZh230CD-_-tlXG@google.com> (raw)
In-Reply-To: <SY5PR01MB106009B0C8D0A657BA9CC5D92A1932@SY5PR01MB10600.ausprd01.prod.outlook.com>

Hi Zhang,

On Thu, Oct 08, 2026 at 10:34:45PM +0000, Zhang Jiaxi wrote:
> From: Jiaxi Zhang <z1529105815@outlook.com>
> 
> The variable-length parameter arrays are checked while advancing the
> offset, but the final misc structure is dereferenced without checking that
> the complete structure fits in the reported IC info length. Reject a
> truncated misc block before reading its register addresses.
> 
> Extracted from the v165 source; no firmware-mode change is included.

What does this mean? What is v165 source?

> 
> Signed-off-by: Jiaxi Zhang <z1529105815@outlook.com>
> 
> ---
> The bounds payload is unchanged and reuses its successful exact-target
> object compilation. No coordinate-mode or reset/resume change is included.

I am not sure what you are trying to say here.

> 
> diff --git a/drivers/input/touchscreen/goodix_berlin_core.c b/drivers/input/touchscreen/goodix_berlin_core.c
> --- a/drivers/input/touchscreen/goodix_berlin_core.c
> +++ b/drivers/input/touchscreen/goodix_berlin_core.c
> @@ -347,6 +347,9 @@
>  	ADVANCE_LE16_PARAMS(); /* stylus_freq_num */
>  #undef ADVANCE_LE16_PARAMS
>  
> +	if (offset + sizeof(*misc) > length)
> +		goto invalid_offset;
> +
>  	misc = (struct goodix_berlin_ic_info_misc *)&data[offset];
>  	cd->touch_data_addr = le32_to_cpu(misc->touch_data_addr);
>  

-- 
Dmitry

      reply	other threads:[~2026-11-13  1:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-08 22:34 [RFC PATCH] Input: goodix-berlin - validate the complete IC info misc block Zhang Jiaxi
2026-11-13  1:04 ` Dmitry Torokhov [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=avZh230CD-_-tlXG@google.com \
    --to=dmitry.torokhov@gmail.com \
    --cc=Z1529105815@outlook.com \
    --cc=hansg@kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox