Skip to content

Commit 57cfc96

Browse files
jigpugregkh
authored andcommitted
HID: wacom: Avoid using stale array indicies to read contact count
commit 20f3cf5 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: linuxwacom/input-wacom#276 Fixes: 003f50a (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>
1 parent 7fd22c9 commit 57cfc96

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

‎drivers/hid/wacom_wac.c‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2654,6 +2654,10 @@ static void wacom_wac_finger_pre_report(struct hid_device *hdev,
26542654

26552655
hid_data->confidence = true;
26562656

2657+
hid_data->cc_report = 0;
2658+
hid_data->cc_index = -1;
2659+
hid_data->cc_value_index = -1;
2660+
26572661
for (i = 0; i < report->maxfield; i++) {
26582662
struct hid_field *field = report->field[i];
26592663
int j;

0 commit comments

Comments
 (0)