提交 fc3ef2e3 编写于 作者: P Pavel Skripkin 提交者: Jiri Kosina

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: c49c3363 ("HID: support for initialization of some Thrustmaster wheels")
Reported-and-tested-by: syzbot+35eebd505e97d315d01c@syzkaller.appspotmail.com
Signed-off-by: NPavel Skripkin <paskripkin@gmail.com>
Signed-off-by: NJiri Kosina <jkosina@suse.cz>
上级 ac898952
...@@ -160,6 +160,12 @@ static void thrustmaster_interrupts(struct hid_device *hdev) ...@@ -160,6 +160,12 @@ static void thrustmaster_interrupts(struct hid_device *hdev)
return; return;
} }
if (usbif->cur_altsetting->desc.bNumEndpoints < 2) {
kfree(send_buf);
hid_err(hdev, "Wrong number of endpoints?\n");
return;
}
ep = &usbif->cur_altsetting->endpoint[1]; ep = &usbif->cur_altsetting->endpoint[1];
b_ep = ep->desc.bEndpointAddress; b_ep = ep->desc.bEndpointAddress;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册