mirror of https://lore.kernel.org/lkml/
 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, linux-kernel

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

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 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®