提交 d9779d7d 编写于 作者: D Dongliang Mu 提交者: Zheng Zengkai

HID: bigben: fix slab-out-of-bounds Write in bigben_probe

stable inclusion
from stable-v5.10.121
commit 296f8ca0f73f5268cd9b85cf72ff783596b2264e
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I5L6CQ

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=296f8ca0f73f5268cd9b85cf72ff783596b2264e

--------------------------------

[ Upstream commit fc4ef9d5 ]

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: Nsyzkaller <syzkaller@googlegroups.com>
Signed-off-by: NDongliang Mu <mudongliangabcd@gmail.com>
Signed-off-by: NJiri Kosina <jkosina@suse.cz>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
上级 380ecf3c
...@@ -347,6 +347,12 @@ static int bigben_probe(struct hid_device *hid, ...@@ -347,6 +347,12 @@ static int bigben_probe(struct hid_device *hid,
bigben->report = list_entry(report_list->next, bigben->report = list_entry(report_list->next,
struct hid_report, list); 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); hidinput = list_first_entry(&hid->inputs, struct hid_input, list);
set_bit(FF_RUMBLE, hidinput->input->ffbit); set_bit(FF_RUMBLE, hidinput->input->ffbit);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册