Skip to content

Commit fc4ef9d

Browse files
mudongliangJiri Kosina
authored andcommitted
HID: bigben: fix slab-out-of-bounds Write in bigben_probe
There is a slab-out-of-bounds Write bug in hid-bigbenff driver. The problem is the driver assumes the device must have an input but some malicious devices violate this assumption. Fix this by checking hid_device's input is non-empty before its usage. Reported-by: syzkaller <[email protected]> Signed-off-by: Dongliang Mu <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
1 parent 1af2071 commit fc4ef9d

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

drivers/hid/hid-bigbenff.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,12 @@ static int bigben_probe(struct hid_device *hid,
347347
bigben->report = list_entry(report_list->next,
348348
struct hid_report, list);
349349

350+
if (list_empty(&hid->inputs)) {
351+
hid_err(hid, "no inputs found\n");
352+
error = -ENODEV;
353+
goto error_hw_stop;
354+
}
355+
350356
hidinput = list_first_entry(&hid->inputs, struct hid_input, list);
351357
set_bit(FF_RUMBLE, hidinput->input->ffbit);
352358

0 commit comments

Comments
 (0)