Skip to content

Commit ffe3b78

Browse files
Ma KeJiri Kosina
authored andcommitted
HID: holtek: fix slab-out-of-bounds Write in holtek_kbd_input_event
There is a slab-out-of-bounds Write bug in hid-holtek-kbd driver. The problem is the driver assumes the device must have an input but some malicious devices violate this assumption. Fix this by checking hid_device's input is non-empty before its usage. Signed-off-by: Ma Ke <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
1 parent 0585748 commit ffe3b78

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

drivers/hid/hid-holtek-kbd.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,10 @@ static int holtek_kbd_input_event(struct input_dev *dev, unsigned int type,
130130
return -ENODEV;
131131

132132
boot_hid = usb_get_intfdata(boot_interface);
133+
if (list_empty(&boot_hid->inputs)) {
134+
hid_err(hid, "no inputs found\n");
135+
return -ENODEV;
136+
}
133137
boot_hid_input = list_first_entry(&boot_hid->inputs,
134138
struct hid_input, list);
135139

0 commit comments

Comments
 (0)