Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Input: ilitek_ts_i2c - add report id message validation

Ensure that the touchscreen response has correct "report id" byte
before processing the touch data and discard other messages.

Fixes: 42370681bd46 ("Input: Add support for ILITEK Lego Series")
Signed-off-by: Emanuele Ghidoli <emanuele.ghidoli@toradex.com>
Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>
Link: https://lore.kernel.org/r/20240805085511.43955-3-francesco@dolcini.it
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

authored by

Emanuele Ghidoli and committed by
Dmitry Torokhov
20898974 7d0b18cd

+7
+7
drivers/input/touchscreen/ilitek_ts_i2c.c
··· 37 37 #define ILITEK_TP_CMD_GET_MCU_VER 0x61 38 38 #define ILITEK_TP_CMD_GET_IC_MODE 0xC0 39 39 40 + #define ILITEK_TP_I2C_REPORT_ID 0x48 41 + 40 42 #define REPORT_COUNT_ADDRESS 61 41 43 #define ILITEK_SUPPORT_MAX_POINT 40 42 44 ··· 163 161 if (error) { 164 162 dev_err(dev, "get touch info failed, err:%d\n", error); 165 163 return error; 164 + } 165 + 166 + if (buf[0] != ILITEK_TP_I2C_REPORT_ID) { 167 + dev_err(dev, "get touch info failed. Wrong id: 0x%02X\n", buf[0]); 168 + return -EINVAL; 166 169 } 167 170 168 171 report_max_point = buf[REPORT_COUNT_ADDRESS];