mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-06 19:08:57 +09:00
HID: hid-thrustmaster: fix OOB read in thrustmaster_interrupts
[ Upstream commitfc3ef2e329] 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:c49c336378("HID: support for initialization of some Thrustmaster wheels") Reported-and-tested-by: syzbot+35eebd505e97d315d01c@syzkaller.appspotmail.com Signed-off-by: Pavel Skripkin <paskripkin@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
a5334502f9
commit
3ffbe85cda
@@ -158,6 +158,12 @@ static void thrustmaster_interrupts(struct hid_device *hdev)
|
||||
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];
|
||||
b_ep = ep->desc.bEndpointAddress;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user