Skip to content

Commit 50420d7

Browse files
KarolPWrJiri Kosina
authored andcommitted
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: c49c336 ("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]>
1 parent 86b05bb commit 50420d7

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

drivers/hid/hid-thrustmaster.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,14 @@ static void thrustmaster_interrupts(struct hid_device *hdev)
170170
ep = &usbif->cur_altsetting->endpoint[1];
171171
b_ep = ep->desc.bEndpointAddress;
172172

173+
/* Are the expected endpoints present? */
174+
u8 ep_addr[1] = {b_ep};
175+
176+
if (!usb_check_int_endpoints(usbif, ep_addr)) {
177+
hid_err(hdev, "Unexpected non-int endpoint\n");
178+
return;
179+
}
180+
173181
for (i = 0; i < ARRAY_SIZE(setup_arr); ++i) {
174182
memcpy(send_buf, setup_arr[i], setup_arr_sizes[i]);
175183

0 commit comments

Comments
 (0)