[PATCH input-wacom 3/4] backport: Input: wacom_w8001 - ignore invalid pen data packets

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
Tested-by: Chris J Arges <christopherarges@xxxxxxxxx>
Signed-off-by: Ping Cheng <pingc@xxxxxxxxx>
Reviewed-by: Peter Hutterer <peter.hutterer@xxxxxxxxx>
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@xxxxxxxxx>
[jason.gerecke@xxxxxxxxx: Imported into input-wacom repository (9e72ac7)]
Signed-off-by: Jason Gerecke <jason.gerecke@xxxxxxxxx>
[aaron.skomra@xxxxxxxxx: backported from input-wacom repository (0ae81e81)]
Signed-off-by: Aaron Skomra <aaron.skomra@xxxxxxxxx>
---
 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

--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]