HID: rmi: Check that the device is a RMI device in suspend and resume callbacks
authorAndrew Duggan <aduggan@synaptics.com>
Tue, 26 Jan 2016 23:40:36 +0000 (15:40 -0800)
committerJiri Kosina <jkosina@suse.cz>
Wed, 27 Jan 2016 21:39:32 +0000 (22:39 +0100)
commitb786ae8e269b5b30fea5efaab8cba32ba9aece61
treee28df6aedf5fdef43d4364ec8bd1ec7aa05582ff
parent962b7a0e77015802f0ceefe6f0e3cad3f10fd4f8
HID: rmi: Check that the device is a RMI device in suspend and resume callbacks

Commit 092563604217 ("HID: rmi: Disable scanning if the device is not a wake
source") introduced a regression for devices which use hid-rmi to handle
composite USB devices. The suspend or resume callbacks are not checking
that the device is a RMI device before calling rmi_read or rmi_write.
This results in dereferencing uninitialized variables on non RMI devices. This
patch checks that the RMI_DEVICE flag is set before sending RMI commands to the
device.

Reported-by: Rodrigo Gomes <rodrigo.toste.gomes@gmail.com>
Signed-off-by: Andrew Duggan <aduggan@synaptics.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
drivers/hid/hid-rmi.c