From: Chris J Arges <christopherarges@gmail.com>
To: linux-input@vger.kernel.org
Cc: Chris J Arges <christopherarges@gmail.com>,
Dmitry Torokhov <dmitry.torokhov@gmail.com>,
Peter Hutterer <peter.hutterer@who-t.net>,
Benjamin Tissoires <benjamin.tissoires@gmail.com>,
Ping Cheng <pingc@wacom.com>,
linux-kernel@vger.kernel.org
Subject: [PATCH] Input: wacom_w8001 - Ignore bogus idx values in interrupt
Date: Sun, 22 May 2016 20:42:23 -0500 [thread overview]
Message-ID: <1463967746-15336-1-git-send-email-christopherarges@gmail.com> (raw)
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.
Signed-off-by: Chris J Arges <christopherarges@gmail.com>
---
drivers/input/touchscreen/wacom_w8001.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/input/touchscreen/wacom_w8001.c b/drivers/input/touchscreen/wacom_w8001.c
index bab3c6a..c858200 100644
--- a/drivers/input/touchscreen/wacom_w8001.c
+++ b/drivers/input/touchscreen/wacom_w8001.c
@@ -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) {
--
2.7.4
next reply other threads:[~2016-05-23 1:42 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-23 1:42 Chris J Arges [this message]
2016-05-23 5:21 ` [PATCH] Input: wacom_w8001 - Ignore bogus idx values in interrupt Ping Cheng
2016-05-23 16:52 ` Dmitry Torokhov
2016-05-23 18:00 ` Ping Cheng
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1463967746-15336-1-git-send-email-christopherarges@gmail.com \
--to=christopherarges@gmail.com \
--cc=benjamin.tissoires@gmail.com \
--cc=dmitry.torokhov@gmail.com \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=peter.hutterer@who-t.net \
--cc=pingc@wacom.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).