Skip to content
Commit 34348a86 authored by Hans de Goede's avatar Hans de Goede Committed by Jiri Kosina
Browse files

HID: lenovo: Check hid_get_drvdata() returns non NULL in lenovo_event()



The HID lenovo probe function only attaches drvdata to one of the
USB interfaces, but lenovo_event() will get called for all USB interfaces
to which hid-lenovo is bound.

This allows a malicious device to fake being a device handled by
hid-lenovo, which generates events for which lenovo_event() has
special handling (and thus dereferences hid_get_drvdata()) on another
interface triggering a NULL pointer exception.

Add a check for hid_get_drvdata() returning NULL, avoiding this
possible NULL pointer exception.

Fixes: bc04b37e ("HID: lenovo: Add ThinkPad 10 Ultrabook Keyboard support")
Reviewed-by: default avatarMarek Behún <kabel@kernel.org>
Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
parent 658d04e6
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment