summaryrefslogtreecommitdiff
path: root/drivers/hid
diff options
context:
space:
mode:
authorJason Gerecke <killertofu@gmail.com>2022-01-18 14:38:41 -0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-01-27 09:19:26 +0100
commitbf9e52c0a9d9d84b67e02cd282f676b0371dd50e (patch)
tree08340da395f2b650d60f5ec0d941b0a647dc0dbe /drivers/hid
parent5d1023f33c6dea8463df347ef13a7e284553e3d5 (diff)
downloadlinux-bf9e52c0a9d9d84b67e02cd282f676b0371dd50e.tar.gz
linux-bf9e52c0a9d9d84b67e02cd282f676b0371dd50e.tar.bz2
linux-bf9e52c0a9d9d84b67e02cd282f676b0371dd50e.zip
HID: wacom: Avoid using stale array indicies to read contact count
commit 20f3cf5f860f9f267a6a6e5642d3d0525edb1814 upstream. If we ever see a touch report with contact count data we initialize several variables used to read the contact count in the pre-report phase. These variables are never reset if we process a report which doesn't contain a contact count, however. This can cause the pre- report function to trigger a read of arbitrary memory (e.g. NULL if we're lucky) and potentially crash the driver. This commit restores resetting of the variables back to default "none" values that were used prior to the commit mentioned below. Link: https://github.com/linuxwacom/input-wacom/issues/276 Fixes: 003f50ab673c (HID: wacom: Update last_slot_field during pre_report phase) CC: stable@vger.kernel.org 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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/hid')
-rw-r--r--drivers/hid/wacom_wac.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c
index be2a89d80c4c..de69ea5f5a4b 100644
--- a/drivers/hid/wacom_wac.c
+++ b/drivers/hid/wacom_wac.c
@@ -2654,6 +2654,10 @@ static void wacom_wac_finger_pre_report(struct hid_device *hdev,
hid_data->confidence = true;
+ hid_data->cc_report = 0;
+ hid_data->cc_index = -1;
+ hid_data->cc_value_index = -1;
+
for (i = 0; i < report->maxfield; i++) {
struct hid_field *field = report->field[i];
int j;