Skip to content

Commit c7bf714

Browse files
pietroborrelloJiri Kosina
authored andcommitted
HID: check empty report_list in bigben_probe()
Add a check for empty report_list in bigben_probe(). The missing check causes a type confusion when issuing a list_entry() on an empty report_list. The problem is caused by the assumption that the device must have valid report_list. While this will be true for all normal HID devices, a suitably malicious device can violate the assumption. Fixes: 256a90e ("HID: hid-bigbenff: driver for BigBen Interactive PS3OFMINIPAD gamepad") Signed-off-by: Pietro Borrello <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
1 parent b12fece commit c7bf714

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

drivers/hid/hid-bigbenff.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,11 @@ static int bigben_probe(struct hid_device *hid,
344344
}
345345

346346
report_list = &hid->report_enum[HID_OUTPUT_REPORT].report_list;
347+
if (list_empty(report_list)) {
348+
hid_err(hid, "no output report found\n");
349+
error = -ENODEV;
350+
goto error_hw_stop;
351+
}
347352
bigben->report = list_entry(report_list->next,
348353
struct hid_report, list);
349354

0 commit comments

Comments
 (0)