Skip to content

Commit fc3ef2e

Browse files
pskrgagJiri Kosina
authored andcommitted
HID: hid-thrustmaster: fix OOB read in thrustmaster_interrupts
Syzbot reported an slab-out-of-bounds Read in thrustmaster_probe() bug. The root case is in missing validation check of actual number of endpoints. Code should not blindly access usb_host_interface::endpoint array, since it may contain less endpoints than code expects. Fix it by adding missing validaion check and print an error if number of endpoints do not match expected number Fixes: c49c336 ("HID: support for initialization of some Thrustmaster wheels") Reported-and-tested-by: [email protected] Signed-off-by: Pavel Skripkin <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
1 parent ac89895 commit fc3ef2e

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

drivers/hid/hid-thrustmaster.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,12 @@ static void thrustmaster_interrupts(struct hid_device *hdev)
160160
return;
161161
}
162162

163+
if (usbif->cur_altsetting->desc.bNumEndpoints < 2) {
164+
kfree(send_buf);
165+
hid_err(hdev, "Wrong number of endpoints?\n");
166+
return;
167+
}
168+
163169
ep = &usbif->cur_altsetting->endpoint[1];
164170
b_ep = ep->desc.bEndpointAddress;
165171

0 commit comments

Comments
 (0)