All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH] Input: goodix-berlin - validate the complete IC info misc block
@ 2026-10-08 22:34 Zhang Jiaxi
  2026-11-13  1:04 ` Dmitry Torokhov
  0 siblings, 1 reply; 2+ messages in thread
From: Zhang Jiaxi @ 2026-10-08 22:34 UTC (permalink / raw)
  To: Hans de Goede, Dmitry Torokhov
  Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org

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.

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.

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);
 

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [RFC PATCH] Input: goodix-berlin - validate the complete IC info misc block
  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
  0 siblings, 0 replies; 2+ messages in thread
From: Dmitry Torokhov @ 2026-11-13  1:04 UTC (permalink / raw)
  To: Zhang Jiaxi
  Cc: Hans de Goede, linux-input@vger.kernel.org,
	linux-kernel@vger.kernel.org

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-13  1:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 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.