]> git.baikalelectronics.ru Git - kernel.git/commit
HID: wacom: Have wacom_tpc_irq guard against possible NULL dereference
authorJason Gerecke <killertofu@gmail.com>
Tue, 25 Apr 2017 18:29:56 +0000 (11:29 -0700)
committerJiri Kosina <jkosina@suse.cz>
Fri, 5 May 2017 12:50:52 +0000 (14:50 +0200)
commitc020f2eced5c81be2efed9f9dc8aa3c9c301e8b6
tree5377d65daa737c5bc52abef64687538ae58a54ff
parent6eb67c35876c3fe757b63d17c73a399742bf2b5b
HID: wacom: Have wacom_tpc_irq guard against possible NULL dereference

The following Smatch complaint was generated in response to commit
52ed239 ("HID: wacom: Introduce new 'touch_input' device"):

    drivers/hid/wacom_wac.c:1586 wacom_tpc_irq()
             error: we previously assumed 'wacom->touch_input' could be null (see line 1577)

The 'touch_input' and 'pen_input' variables point to the 'struct input_dev'
used for relaying touch and pen events to userspace, respectively. If a
device does not have a touch interface or pen interface, the associated
input variable is NULL. The 'wacom_tpc_irq()' function is responsible for
forwarding input reports to a more-specific IRQ handler function. An
unknown report could theoretically be mistaken as e.g. a touch report
on a device which does not have a touch interface. This can be prevented
by only calling the pen/touch functions are called when the pen/touch
pointers are valid.

Fixes: 52ed239 ("HID: wacom: Introduce new 'touch_input' device")
Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com>
Reviewed-by: Ping Cheng <ping.cheng@wacom.com>
Cc: stable@vger.kernel.org
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
drivers/hid/wacom_wac.c