OSDN Git Service

HID: Fix assumption that devices have inputs
authorAlan Stern <stern@rowland.harvard.edu>
Thu, 3 Oct 2019 18:53:59 +0000 (14:53 -0400)
committerBenjamin Tissoires <benjamin.tissoires@redhat.com>
Thu, 3 Oct 2019 19:36:40 +0000 (15:36 -0400)
commitd9d4b1e46d9543a82c23f6df03f4ad697dab361b
tree5a405a2f78b1029f4cc6d6ee743f0bec31319b42
parentfe2199cfd1516e90e03c033c52c9a28da09d9986
HID: Fix assumption that devices have inputs

The syzbot fuzzer found a slab-out-of-bounds write bug in the hid-gaff
driver.  The problem is caused by the driver's assumption that the
device must have an input report.  While this will be true for all
normal HID input devices, a suitably malicious device can violate the
assumption.

The same assumption is present in over a dozen other HID drivers.
This patch fixes them by checking that the list of hid_inputs for the
hid_device is nonempty before allowing it to be used.

Reported-and-tested-by: syzbot+403741a091bf41d4ae79@syzkaller.appspotmail.com
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
CC: <stable@vger.kernel.org>
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
14 files changed:
drivers/hid/hid-axff.c
drivers/hid/hid-dr.c
drivers/hid/hid-emsff.c
drivers/hid/hid-gaff.c
drivers/hid/hid-holtekff.c
drivers/hid/hid-lg2ff.c
drivers/hid/hid-lg3ff.c
drivers/hid/hid-lg4ff.c
drivers/hid/hid-lgff.c
drivers/hid/hid-logitech-hidpp.c
drivers/hid/hid-microsoft.c
drivers/hid/hid-sony.c
drivers/hid/hid-tmff.c
drivers/hid/hid-zpff.c