Skip to content

Commit 1cc1cc9

Browse files
Brent AdamJiri Kosina
authored andcommitted
HID: multitouch: Fix fields from pen report ID being interpreted for multitouch
Fields like HID_DG_CONTACTCOUNT are outside of the physical collection, but within the application collection and report ID. Make sure to catch those fields that are not part of the mt_report_id and return 0 so they can be processed with the pen. Otherwise, the wrong HID_DG_CONTACTCOUNT will be applied to cc_index and result in dereferencing a null pointer in mt_touch_report. Signed-off-by: Brent Adam <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
1 parent c5b2b80 commit 1cc1cc9

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

drivers/hid/hid-multitouch.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -778,9 +778,16 @@ static int mt_input_mapping(struct hid_device *hdev, struct hid_input *hi,
778778
/*
779779
* some egalax touchscreens have "application == HID_DG_TOUCHSCREEN"
780780
* for the stylus.
781+
* The check for mt_report_id ensures we don't process
782+
* HID_DG_CONTACTCOUNT from the pen report as it is outside the physical
783+
* collection, but within the report ID.
781784
*/
782785
if (field->physical == HID_DG_STYLUS)
783786
return 0;
787+
else if ((field->physical == 0) &&
788+
(field->report->id != td->mt_report_id) &&
789+
(td->mt_report_id != -1))
790+
return 0;
784791

785792
if (field->application == HID_DG_TOUCHSCREEN ||
786793
field->application == HID_DG_TOUCHPAD)

0 commit comments

Comments
 (0)