Input: wacom_w8001 - Ignore bogus idx values in interrupt
Subsystems (2)
PATCH 1/1 Input: wacom_w8001 - Ignore bogus idx values in interrupt
I've noticed crashes when using my x60t using a coreboot bios. When using the pen I can produce a crash simply by tapping a few times. This generates an event which has an idx of 0xc. This in turn crashes the machine because the array access is greater than W8001_MAX_LENGTH. This patch checks for bogus values and filters them in order to prevent crashes.
--- drivers/input/touchscreen/wacom_w8001.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/input/touchscreen/wacom_w8001.c +9 -0
@@ -283,6 +283,15 @@ static irqreturn_t w8001_interrupt(struct serio *serio,unsigned char tmp; w8001->data[w8001->idx] = data; + +/* ignore bogus idx values */ +if (w8001->idx >=W8001_MAX_LENGTH ) { +pr_info ("w8001: ignored interrupt: data 0x%02x idx %d\n" , data, + w8001->idx); + w8001->idx =0 ; +return IRQ_HANDLED ; + } +switch (w8001->idx++) {case 0 :if ((data &W8001_LEAD_MASK ) !=W8001_LEAD_BYTE ) {
Signature · 1 line
2.7.4
Hi Chris,
Quoted 5 lines · Chris J Arges
I've noticed crashes when using my x60t using a coreboot bios. When using the pen I can produce a crash simply by tapping a few times. This generates an event which has an idx of
0xc. This in turn crashes the machine because the array access is greater thanW8001_MAX_LENGTH. This patch checks for bogus values and filters them in order to prevent crashes.
Thank you for submitting a patch in addition to reporting the issue.
Quoted 12 lines
Signed-off-by Chris J Arges <[email protected]>--- drivers/input/touchscreen/wacom_w8001.c | 9 +++++++++ 1 file changed, 9 insertions(+)drivers/input/touchscreen/wacom_w8001.c +0
-0@@ -283,6 +283,15 @@ static irqreturn_t w8001_interrupt(struct serio *serio,unsigned char tmp;
drivers/input/touchscreen/wacom_w8001.c static irqreturn_t w8001_interrupt(struct serio *serio, · line 294
Quoted 10 lines
drivers/input/touchscreen/wacom_w8001.c +9
-0w8001->data[w8001->idx] = data; + +/* ignore bogus idx values */ +if (w8001->idx >=W8001_MAX_LENGTH ) { +pr_info ("w8001: ignored interrupt: data 0x%02x idx %d\n" , data, + w8001->idx); + w8001->idx =0 ; +return IRQ_HANDLED ; + } +
I don't have an x60t system to test with. I wonder if your system supports two finger touch or not. We at least have a bug in the code since W8001_MAX_LENGTH should be 13 instead of 11. How come no one had encountered that issue before?
I'm going to email a patch to the list. Please test it and let us know your result. Maybe we still need your patch if your device doesn't support two finger touch or the idx=0xc can't be fixed by W8001_MAX_LENGTH=13.
Thanks,
Ping
Quoted 10 lines
drivers/input/touchscreen/wacom_w8001.c +0
-1switch (w8001->idx++) {case 0 :if ((data &W8001_LEAD_MASK ) !=W8001_LEAD_BYTE ) { --2.7.4
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Dmitry Torokhov
maintainerQuoted 40 lines · Ping Cheng
Hi Chris,
Quoted 5 lines · Chris J Arges
I've noticed crashes when using my x60t using a coreboot bios. When using the pen I can produce a crash simply by tapping a few times. This generates an event which has an idx of
0xc. This in turn crashes the machine because the array access is greater thanW8001_MAX_LENGTH. This patch checks for bogus values and filters them in order to prevent crashes.Thank you for submitting a patch in addition to reporting the issue.
Quoted 12 lines
Signed-off-by Chris J Arges <[email protected]>--- drivers/input/touchscreen/wacom_w8001.c | 9 +++++++++ 1 file changed, 9 insertions(+)drivers/input/touchscreen/wacom_w8001.c +0
-0@@ -283,6 +283,15 @@ static irqreturn_t w8001_interrupt(struct serio *serio,unsigned char tmp;drivers/input/touchscreen/wacom_w8001.c static irqreturn_t w8001_interrupt(struct serio *serio, · line 294
Quoted 10 lines
drivers/input/touchscreen/wacom_w8001.c +9
-0w8001->data[w8001->idx] = data; + +/* ignore bogus idx values */ +if (w8001->idx >=W8001_MAX_LENGTH ) { +pr_info ("w8001: ignored interrupt: data 0x%02x idx %d\n" , data, + w8001->idx); + w8001->idx =0 ; +return IRQ_HANDLED ; + } +I don't have an x60t system to test with. I wonder if your system supports two finger touch or not. We at least have a bug in the code since
W8001_MAX_LENGTHshould be 13 instead of 11. How come no one had encountered that issue before?
Quoted 4 lines
I'm going to email a patch to the list. Please test it and let us know your result. Maybe we still need your patch if your device doesn't support two finger touch or the idx=0xc can't be fixed by W8001_MAX_LENGTH=13.
Just so we are clear this version of the patch is buggy as we check the index only after [potentially] writing past the array bounds of w8001->data[].
Thanks.
Signature · 1 line
Dmitry
Quoted 41 lines · Dmitry Torokhov
Quoted 40 lines · Ping Cheng
Hi Chris,
Quoted 5 lines · Chris J Arges
I've noticed crashes when using my x60t using a coreboot bios. When using the pen I can produce a crash simply by tapping a few times. This generates an event which has an idx of
0xc. This in turn crashes the machine because the array access is greater thanW8001_MAX_LENGTH. This patch checks for bogus values and filters them in order to prevent crashes.Thank you for submitting a patch in addition to reporting the issue.
Quoted 12 lines
Signed-off-by Chris J Arges <[email protected]>--- drivers/input/touchscreen/wacom_w8001.c | 9 +++++++++ 1 file changed, 9 insertions(+)drivers/input/touchscreen/wacom_w8001.c +0
-0@@ -283,6 +283,15 @@ static irqreturn_t w8001_interrupt(struct serio *serio,unsigned char tmp;drivers/input/touchscreen/wacom_w8001.c static irqreturn_t w8001_interrupt(struct serio *serio, · line 294
Quoted 10 lines
drivers/input/touchscreen/wacom_w8001.c +9
-0w8001->data[w8001->idx] = data; + +/* ignore bogus idx values */ +if (w8001->idx >=W8001_MAX_LENGTH ) { +pr_info ("w8001: ignored interrupt: data 0x%02x idx %d\n" , data, + w8001->idx); + w8001->idx =0 ; +return IRQ_HANDLED ; + } +I don't have an x60t system to test with. I wonder if your system supports two finger touch or not. We at least have a bug in the code since
W8001_MAX_LENGTHshould be 13 instead of 11. How come no one had encountered that issue before?
Quoted 8 lines
Quoted 4 lines
I'm going to email a patch to the list. Please test it and let us know your result. Maybe we still need your patch if your device doesn't support two finger touch or the idx=0xc can't be fixed by W8001_MAX_LENGTH=13.
Just so we are clear this version of the patch is buggy as we check the index only after [potentially] writing past the array bounds of w8001->data[].
Thanks for the heads up. I noticed that last night. Since it breaks two-finger touch, we won't use it anyway.
My other patch is still necessary though. You'll need to change:
From: wacom <[email protected]>
to
From: Ping Cheng <[email protected]>
I made it on a brand new system, which I didn't setup the environment properly. I can update the patch if that's what you like...
Ping