Linux Input/HID development
 help / color / mirror / Atom feed
* [PATCH] Input: usbtouchscreen - validate Nexio reply length
@ 2026-06-30  6:52 Pengpeng Hou
  2026-06-30  7:04 ` sashiko-bot
  0 siblings, 1 reply; 2+ messages in thread
From: Pengpeng Hou @ 2026-06-30  6:52 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: linux-input, linux-kernel, Pengpeng Hou

nexio_init() accepts replies with actual_len == 1 and then reads buf[1]
to compare the embedded length.

Require at least two bytes before checking the embedded reply length.

Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>
---
 drivers/input/touchscreen/usbtouchscreen.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/input/touchscreen/usbtouchscreen.c b/drivers/input/touchscreen/usbtouchscreen.c
index 0bbacb5..0e07bcc 100644
--- a/drivers/input/touchscreen/usbtouchscreen.c
+++ b/drivers/input/touchscreen/usbtouchscreen.c
@@ -1011,7 +1011,7 @@ static int nexio_init(struct usbtouch_usb *usbtouch)
 		ret = usb_bulk_msg(dev, usb_rcvbulkpipe(dev, input_ep),
 				   buf, NEXIO_BUFSIZE, &actual_len,
 				   NEXIO_TIMEOUT);
-		if (ret < 0 || actual_len < 1 || buf[1] != actual_len)
+		if (ret < 0 || actual_len < 2 || buf[1] != actual_len)
 			continue;
 		switch (buf[0]) {
 		case 0x83:	/* firmware version */


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

end of thread, other threads:[~2026-06-30  7:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-30  6:52 [PATCH] Input: usbtouchscreen - validate Nexio reply length Pengpeng Hou
2026-06-30  7:04 ` sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox