Skip to content

Commit 0b43d98

Browse files
tuliofernandesJiri Kosina
authored and
Jiri Kosina
committedFeb 7, 2025
HID: hid-thrustmaster: fix stack-out-of-bounds read in usb_check_int_endpoints()
Syzbot[1] has detected a stack-out-of-bounds read of the ep_addr array from hid-thrustmaster driver. This array is passed to usb_check_int_endpoints function from usb.c core driver, which executes a for loop that iterates over the elements of the passed array. Not finding a null element at the end of the array, it tries to read the next, non-existent element, crashing the kernel. To fix this, a 0 element was added at the end of the array to break the for loop. [1] https://syzkaller.appspot.com/bug?extid=9c9179ac46169c56c1ad Reported-by: syzbot+9c9179ac46169c56c1ad@syzkaller.appspotmail.com Fixes: 50420d7 ("HID: hid-thrustmaster: Fix warning in thrustmaster_probe by adding endpoint check") Signed-off-by: Túlio Fernandes <tuliomf09@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.com>
1 parent 819083c commit 0b43d98

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed
 

‎drivers/hid/hid-thrustmaster.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ static void thrustmaster_interrupts(struct hid_device *hdev)
171171
b_ep = ep->desc.bEndpointAddress;
172172

173173
/* Are the expected endpoints present? */
174-
u8 ep_addr[1] = {b_ep};
174+
u8 ep_addr[2] = {b_ep, 0};
175175

176176
if (!usb_check_int_endpoints(usbif, ep_addr)) {
177177
hid_err(hdev, "Unexpected non-int endpoint\n");

0 commit comments

Comments
 (0)
Please sign in to comment.