On Thu, Nov 05, 2026 at 10:13:03AM +0800, Guanglei Zhu wrote:
The row and column pin lists are read straight from the device tree
and used to index the pin configuration array:
for (i = 0; i < num_rows; i++) {
kbc->pin_cfg[rows_cfg[i]].type = PIN_CFG_ROW;
kbc->pin_cfg[rows_cfg[i]].num = i;
}
The helper only limits how many entries it reads, not what they
contain. Not all Tegra variants have KBC_MAX_GPIO pins - Tegra114,
for example, has 11 rows + 8 columns = 19 - and the setup loop only
initializes pin_cfg[] up to kbc->num_rows_and_columns, so a device
tree that names a pin the variant does not have makes the row and
column stores write over pin_cfg entries that were never touched,
and the later check_pin_cfg() walk reads that stale data back as
valid configuration.
Reject pin numbers the variant does not have.
Fixes: 88390243a993 ("Input: tegra-kbc - add support for rows/columns configuration from dt")
Cc: <redacted>
Signed-off-by: Guanglei Zhu <redacted>
Applied, thank you (but dropped stable).
--
Dmitry