Jason Gerecke 2a5e597c6b HID: wacom: Always increment hdev refcount within wacom_get_hdev_data
The wacom_get_hdev_data function is used to find and return a reference to
the "other half" of a Wacom device (i.e., the touch device associated with
a pen, or vice-versa). To ensure these references are properly accounted
for, the function is supposed to automatically increment the refcount before
returning. This was not done, however, for devices which have pen & touch
on different interfaces of the same USB device. This can lead to a WARNING
("refcount_t: underflow; use-after-free") when removing the module or device
as we call kref_put() more times than kref_get(). Triggering an "actual" use-
after-free would be difficult since both devices will disappear nearly-
simultaneously. To silence this warning and prevent the potential error, we
need to increment the refcount for all cases within wacom_get_hdev_data.

Fixes: 41372d5d40 ("HID: wacom: Augment 'oVid' and 'oPid' with heuristics for HID_GENERIC")
Cc: <stable@vger.kernel.org> # v4.9+
Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com>
Reviewed-by: Ping Cheng <ping.cheng@wacom.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2017-10-02 11:45:29 +02:00
..
2015-10-21 13:15:53 +02:00
2013-01-03 10:27:31 +01:00
2014-08-21 10:43:28 -05:00
2016-06-01 14:08:17 +02:00
2013-01-03 10:27:31 +01:00
2013-01-03 10:27:31 +01:00
2015-12-28 13:41:44 +01:00
2013-04-24 16:32:27 +02:00
2017-05-11 10:27:48 +02:00
2013-01-03 10:27:31 +01:00
2015-12-28 13:41:44 +01:00
2013-01-03 10:27:31 +01:00
2015-12-28 13:41:51 +01:00
2015-12-28 13:41:51 +01:00
2015-12-28 13:41:51 +01:00
2015-12-28 13:41:51 +01:00
2015-12-28 13:41:51 +01:00
2015-12-28 13:41:51 +01:00
2015-12-28 13:41:51 +01:00
2015-12-28 13:41:51 +01:00
2013-01-03 10:27:31 +01:00
2015-05-07 10:47:53 +02:00
2015-12-28 13:41:44 +01:00
2014-08-21 10:43:28 -05:00
2013-01-03 10:27:31 +01:00
2013-01-03 10:27:31 +01:00
2015-12-28 13:41:44 +01:00
2017-08-01 11:22:21 +02:00
2017-07-27 15:14:28 +02:00