[PATCH 3/7] HID: roccat: konepure: reject short button reports
From: Jiale Yao
Date: Thu Sep 24 2026 - 10:38:25 EST
The raw event callback runs before HID core validates and zero-pads the
report. It reads the report number without checking the received length
and passes matching data to roccat_report_event(), which copies a complete
struct konepure_mouse_report_button. A truncated report can therefore
cause an out-of-bounds read and expose adjacent data through the Roccat
character device.
Require a complete button report before inspecting or forwarding it.
Commit 47669bec44fe ("HID: asus: refactor the two workqueues and init
sequence") added the same kind of raw-event length validation to hid-asus.
Fixes: 8936aa31cd5f ("HID: roccat: add support for Roccat Kone Pure gaming mouse")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Jiale Yao <yaojiale02@xxxxxxx>
---
drivers/hid/hid-roccat-konepure.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/hid/hid-roccat-konepure.c b/drivers/hid/hid-roccat-konepure.c
index 7f753dfc2a10..529466c33bf8 100644
--- a/drivers/hid/hid-roccat-konepure.c
+++ b/drivers/hid/hid-roccat-konepure.c
@@ -181,6 +181,9 @@ static int konepure_raw_event(struct hid_device *hdev,
!= USB_INTERFACE_PROTOCOL_MOUSE)
return 0;
+ if (size < sizeof(struct konepure_mouse_report_button))
+ return 0;
+
if (data[0] != KONEPURE_MOUSE_REPORT_NUMBER_BUTTON)
return 0;
--
2.34.1