mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git
synced 2026-11-01 23:04:54 +01:00
HID: hid-thrustmaster: Fix warning in thrustmaster_probe by adding endpoint check
syzbot has found a type mismatch between a USB pipe and the transfer
endpoint, which is triggered by the hid-thrustmaster driver[1].
There is a number of similar, already fixed issues [2].
In this case as in others, implementing check for endpoint type fixes the issue.
[1] https://syzkaller.appspot.com/bug?extid=040e8b3db6a96908d470
[2] https://syzkaller.appspot.com/bug?extid=348331f63b034f89b622
Fixes: c49c336378 ("HID: support for initialization of some Thrustmaster wheels")
Reported-by: [email protected]
Tested-by: [email protected]
Signed-off-by: Karol Przybylski <[email protected]>
Signed-off-by: Jiri Kosina <[email protected]>
This commit is contained in:
1 parent
86b05bb2d4
commit
50420d7c79
1 file changed
+8
@@ -170,6 +170,14 @@ static void thrustmaster_interrupts(struct hid_device *hdev)
|
||||
ep = &usbif->cur_altsetting->endpoint[1];
|
||||
b_ep = ep->desc.bEndpointAddress;
|
||||
|
||||
/* Are the expected endpoints present? */
|
||||
u8 ep_addr[1] = {b_ep};
|
||||
|
||||
if (!usb_check_int_endpoints(usbif, ep_addr)) {
|
||||
hid_err(hdev, "Unexpected non-int endpoint\n");
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(setup_arr); ++i) {
|
||||
memcpy(send_buf, setup_arr[i], setup_arr_sizes[i]);
|
||||
|
||||
|
||||
Reference in new issue
Block a user