mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
HID: roccat: pyra: reject short button reports
The raw event callback runs before HID core validates and zero-pads the report. It passes the buffer to helpers which inspect data[0] and read a complete struct pyra_mouse_event_button for button reports. A truncated report can therefore cause an out-of-bounds read. Require enough data for the button report before calling either helper. Commit47669bec44("HID: asus: refactor the two workqueues and init sequence") added the same kind of raw-event length validation to hid-asus. Fixes:cb7cf3da0d("HID: roccat: add driver for Roccat Pyra mouse") Cc: stable@vger.kernel.org Signed-off-by: Jiale Yao <yaojiale02@163.com> Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
This commit is contained in:
parent
e95917a606
commit
493268f459
|
|
@ -557,6 +557,9 @@ static int pyra_raw_event(struct hid_device *hdev, struct hid_report *report,
|
|||
if (pyra == NULL)
|
||||
return 0;
|
||||
|
||||
if (size < sizeof(struct pyra_mouse_event_button))
|
||||
return 0;
|
||||
|
||||
pyra_keep_values_up_to_date(pyra, data);
|
||||
|
||||
if (pyra->roccat_claimed)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user