Re: [PATCH v3] Input: lpc32xx-keys - reject matrices bigger than the hardware has

From
Dmitry Torokhov <dmitry.torokhov@gmail.com>
Date
2026-11-09 08:07:21
Also in
lkml, stable
Reply to
Guanglei Zhu, 2026-11-06
On Fri, Nov 06, 2026 at 09:49:28AM +0800, Guanglei Zhu wrote:
The scanner state array holds the last state of eight matrix
columns, and the interrupt handler walks the matrix size that the
device tree declared:

	u8 lastkeystates[8];
	...
	for (i = 0; i < kscandat->matrix_sz; i++)
		lpc32xx_mod_states(kscandat, i);

The probe path only checks that rows and columns match; the
hardware supports square matrices from 1x1 up to 8x8, but nothing
stops a device tree from declaring more, which makes the state
array index run past the field into the rest of the driver data -
including the keymap pointer the same code dereferences.

Reject matrices larger than the hardware supports.

Fixes: 69690bec400e ("Input: add support for key scan interface of the LPC32xx SoC")
Cc: <redacted>
Signed-off-by: Guanglei Zhu <redacted>
Applied, thank you (but dropped stable).

-- 
Dmitry
Thread (32 messages) 32 messages, 3 authors, last reply 9d ago
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help