summaryrefslogtreecommitdiff
path: root/drivers/hid
diff options
context:
space:
mode:
authorJason Gerecke <killertofu@gmail.com>2021-07-19 13:55:31 -0700
committerJiri Kosina <jkosina@suse.cz>2021-07-28 11:43:48 +0200
commit7cc8524f65ce1a350042836c7cf837046aaa6e21 (patch)
treea5615e50436e5701a0c325afdecb301e7a698671 /drivers/hid
parent6ca2350e11f09d5d3e53777d1eff8ff6d300ed93 (diff)
downloadlwn-7cc8524f65ce1a350042836c7cf837046aaa6e21.tar.gz
lwn-7cc8524f65ce1a350042836c7cf837046aaa6e21.zip
HID: wacom: Skip processing of touches with negative slot values
The `input_mt_get_slot_by_key` function may return a negative value if an error occurs (e.g. running out of slots). If this occurs we should really avoid reporting any data for the slot. Signed-off-by: Ping Cheng <ping.cheng@wacom.com> Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid')
-rw-r--r--drivers/hid/wacom_wac.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c
index 496a000ef862..81ba642adcb7 100644
--- a/drivers/hid/wacom_wac.c
+++ b/drivers/hid/wacom_wac.c
@@ -2548,6 +2548,9 @@ static void wacom_wac_finger_slot(struct wacom_wac *wacom_wac,
int slot;
slot = input_mt_get_slot_by_key(input, hid_data->id);
+ if (slot < 0)
+ return;
+
input_mt_slot(input, slot);
input_mt_report_slot_state(input, MT_TOOL_FINGER, prox);
}