Commit fc4ef9d5 authored by Dongliang Mu's avatar Dongliang Mu Committed by Jiri Kosina
Browse files

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: default avatarsyzkaller <syzkaller@googlegroups.com>
Signed-off-by: default avatarDongliang Mu <mudongliangabcd@gmail.com>
Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
parent 1af20714
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -347,6 +347,12 @@ static int bigben_probe(struct hid_device *hid,
	bigben->report = list_entry(report_list->next,
		struct hid_report, list);

	if (list_empty(&hid->inputs)) {
		hid_err(hid, "no inputs found\n");
		error = -ENODEV;
		goto error_hw_stop;
	}

	hidinput = list_first_entry(&hid->inputs, struct hid_input, list);
	set_bit(FF_RUMBLE, hidinput->input->ffbit);