mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
HID: zydacron: validate key report length
The HID core invokes raw_event callbacks before validating the report length. zc_raw_event() verifies the report ID in byte zero and then reads the key code from byte one for report IDs 0x02 and 0x03 without checking that the second byte is present. A one-byte report reproduced the issue under KASAN: BUG: KASAN: slab-out-of-bounds in zc_raw_event+0x54c/0x580 Read of size 1 by task hidtrigger/93 Call Trace: zc_raw_event+0x54c/0x580 __hid_input_report+0x2ef/0x3a0 inject_store+0x479/0x490 [faketrans] Require both the report ID and key code before processing the report. Commit47669bec44("HID: asus: refactor the two workqueues and init sequence") added the same kind of raw_event length validation to hid-asus. Fixes:d0742abaa1("HID: add omitted hid-zydacron.c file") Cc: stable@vger.kernel.org Signed-off-by: Jiale Yao <yaojiale02@163.com> Signed-off-by: Jiri Kosina <jkosina@suse.com>
This commit is contained in:
parent
0deb22da5a
commit
9932c9af18
|
|
@ -114,6 +114,9 @@ static int zc_raw_event(struct hid_device *hdev, struct hid_report *report,
|
|||
unsigned key;
|
||||
unsigned short index;
|
||||
|
||||
if (size < 2)
|
||||
return 0;
|
||||
|
||||
if (report->id == data[0] && (hdev->claimed & HID_CLAIMED_INPUT)) {
|
||||
|
||||
/* break keys */
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user