stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Aaron Armstrong Skomra <skomra@gmail.com>
To: linuxwacom-devel@lists.sourceforge.net, pinglinux@gmail.com,
	killertofu@gmail.com
Cc: Aaron Armstrong Skomra <skomra@gmail.com>,
	Ping Cheng <pingc@wacom.com>,
	stable@vger.kernel.org,
	Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	Jason Gerecke <jason.gerecke@wacom.com>,
	Aaron Skomra <aaron.skomra@wacom.com>
Subject: [PATCH input-wacom 3/4] backport: Input: wacom_w8001 - ignore invalid pen data packets
Date: Wed, 13 Jul 2016 15:45:28 -0700	[thread overview]
Message-ID: <1468449929-17092-3-git-send-email-skomra@gmail.com> (raw)
In-Reply-To: <1468449929-17092-1-git-send-email-skomra@gmail.com>

ThinkPad X60 Tablet PC (pen only device) sometime posts
packets that are larger than W8001_PKTLEN_TPCPEN.

NOTE: The w8001 struct has no touch_dev member in 2.6.36
or 2.6.30.

Reported-by: Chris J Arges <christopherarges@gmail.com>
Tested-by: Chris J Arges <christopherarges@gmail.com>
Signed-off-by: Ping Cheng <pingc@wacom.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Cc: stable@vger.kernel.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
[jason.gerecke@wacom.com: Imported into input-wacom repository (9e72ac7)]
Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com>
[aaron.skomra@wacom.com: backported from input-wacom repository (0ae81e81)]
Signed-off-by: Aaron Skomra <aaron.skomra@wacom.com>
---
 2.6.38/wacom_w8001.c | 9 +++++++++
 3.7/wacom_w8001.c    | 9 +++++++++
 2 files changed, 18 insertions(+)

diff --git a/2.6.38/wacom_w8001.c b/2.6.38/wacom_w8001.c
index ed04bb9..de7b8ef 100644
--- a/2.6.38/wacom_w8001.c
+++ b/2.6.38/wacom_w8001.c
@@ -339,6 +339,15 @@ static irqreturn_t w8001_interrupt(struct serio *serio,
 		w8001->idx = 0;
 		parse_multi_touch(w8001);
 		break;
+
+	default:
+		/*
+		 * ThinkPad X60 Tablet PC (pen only device) sometimes
+		 * sends invalid data packets that are larger than
+		 * W8001_PKTLEN_TPCPEN. Let's start over again.
+		 */
+		if (!w8001->touch_dev && w8001->idx > W8001_PKTLEN_TPCPEN - 1)
+			w8001->idx = 0;
 	}
 
 	return IRQ_HANDLED;
diff --git a/3.7/wacom_w8001.c b/3.7/wacom_w8001.c
index b1b4127..0c9191c 100644
--- a/3.7/wacom_w8001.c
+++ b/3.7/wacom_w8001.c
@@ -339,6 +339,15 @@ static irqreturn_t w8001_interrupt(struct serio *serio,
 		w8001->idx = 0;
 		parse_multi_touch(w8001);
 		break;
+
+	default:
+		/*
+		 * ThinkPad X60 Tablet PC (pen only device) sometimes
+		 * sends invalid data packets that are larger than
+		 * W8001_PKTLEN_TPCPEN. Let's start over again.
+		 */
+		if (!w8001->touch_dev && w8001->idx > W8001_PKTLEN_TPCPEN - 1)
+			w8001->idx = 0;
 	}
 
 	return IRQ_HANDLED;
-- 
1.9.1


      parent reply	other threads:[~2016-07-13 22:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1468449929-17092-1-git-send-email-skomra@gmail.com>
2016-07-13 22:45 ` [PATCH input-wacom 2/4] backport: Input: wacom_w8001 - w8001_MAX_LENGTH should be 13 Aaron Armstrong Skomra
2016-07-13 22:57   ` Greg KH
2016-07-13 22:45 ` Aaron Armstrong Skomra [this message]

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=1468449929-17092-3-git-send-email-skomra@gmail.com \
    --to=skomra@gmail.com \
    --cc=aaron.skomra@wacom.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=jason.gerecke@wacom.com \
    --cc=killertofu@gmail.com \
    --cc=linuxwacom-devel@lists.sourceforge.net \
    --cc=pingc@wacom.com \
    --cc=pinglinux@gmail.com \
    --cc=stable@vger.kernel.org \
    /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).