HID: holtek: fix slab-out-of-bounds Write in holtek_kbd_input_event
authorMa Ke <make_ruc2021@163.com>
Mon, 18 Sep 2023 02:40:59 +0000 (10:40 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 25 Oct 2023 10:03:10 +0000 (12:03 +0200)
commit7d823a1071c6365066608a2762378bd9344ad1b5
treede73de27e135c0ea6b38b3f69a2d6cc64ec48b23
parentf45752f1eb91aacdc6abebce80b04755396ae38c
HID: holtek: fix slab-out-of-bounds Write in holtek_kbd_input_event

[ Upstream commit ffe3b7837a2bb421df84d0177481db9f52c93a71 ]

There is a slab-out-of-bounds Write bug in hid-holtek-kbd 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.

Signed-off-by: Ma Ke <make_ruc2021@163.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/hid/hid-holtek-kbd.c