From 4b6101e1f94bd402b44e5034642b5db2c9359009 Mon Sep 17 00:00:00 2001 From: Tatsunosuke Tobita Date: Wed, 1 Apr 2026 09:52:19 +0900 Subject: [PATCH] HID: wacom: fix out-of-bounds read in wacom_intuos_bt_irq MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit he wacom_intuos_bt_irq() function processes Bluetooth HID reports without sufficient bounds checking. A maliciously crafted short report can trigger an out-of-bounds read when copying data into the wacom structure. Specifically, report 0x03 requires at least 22 bytes to safely read the processed data and battery status, while report 0x04 (which falls through to 0x03) requires 32 bytes. Add explicit length checks for these report IDs and log a warning if a short report is received. Signed-off-by: BenoƮt Sevens Reviewed-by: Jason Gerecke Signed-off-by: Jiri Kosina [tatsunosuke.tobita@wacom.com: Imported into input-wacom (2f1763f62909)] Signed-off-by: Tatsunosuke Tobita Link: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/drivers/hid/wacom_wac.c?h=v7.0-rc6&id=2f1763f62909ccb6386ac50350fa0abbf5bb16a9 --- 4.18/wacom_wac.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/4.18/wacom_wac.c b/4.18/wacom_wac.c index e672dc12..c4c8d500 100644 --- a/4.18/wacom_wac.c +++ b/4.18/wacom_wac.c @@ -1224,10 +1224,20 @@ static int wacom_intuos_bt_irq(struct wacom_wac *wacom, size_t len) switch (data[0]) { case 0x04: + if (len < 32) { + dev_warn(wacom->pen_input->dev.parent, + "Report 0x04 too short: %zu bytes\n", len); + break; + } wacom_intuos_bt_process_data(wacom, data + i); i += 10; fallthrough; case 0x03: + if (i == 1 && len < 22) { + dev_warn(wacom->pen_input->dev.parent, + "Report 0x03 too short: %zu bytes\n", len); + break; + } wacom_intuos_bt_process_data(wacom, data + i); i += 10; wacom_intuos_bt_process_data(wacom, data + i);