HID: betop: check shape of output reports
authorPietro Borrello <borrello@diag.uniroma1.it>
Wed, 11 Jan 2023 18:12:16 +0000 (18:12 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 1 Feb 2023 07:27:13 +0000 (08:27 +0100)
commit1a2a47b85cab50a3c146731bfeaf2d860f5344ee
tree87e3400e027fac68a28bc13e9f3fd66cb8ef47c4
parentb2a730974373efa1050770c69ccd768eafdee19b
HID: betop: check shape of output reports

[ Upstream commit 3782c0d6edf658b71354a64d60aa7a296188fc90 ]

betopff_init() only checks the total sum of the report counts for each
report field to be at least 4, but hid_betopff_play() expects 4 report
fields.
A device advertising an output report with one field and 4 report counts
would pass the check but crash the kernel with a NULL pointer dereference
in hid_betopff_play().

Fixes: 52cd7785f3cd ("HID: betop: add drivers/hid/hid-betopff.c")
Signed-off-by: Pietro Borrello <borrello@diag.uniroma1.it>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/hid/hid-betopff.c