summaryrefslogtreecommitdiffstats
path: root/drivers/input
diff options
context:
space:
mode:
authorOleksij Rempel <external.Oleksij.Rempel@de.bosch.com>2015-07-13 18:54:42 +0200
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2015-07-16 19:47:30 +0200
commit7d01cd261c76f95913c81554a751968a1d282d3a (patch)
treec7f498c293813cbe977df45047a21251aae0811e /drivers/input
parentRevert "Input: synaptics - allocate 3 slots to keep stability in image sensors" (diff)
downloadlinux-7d01cd261c76f95913c81554a751968a1d282d3a.tar.xz
linux-7d01cd261c76f95913c81554a751968a1d282d3a.zip
Input: zforce - don't overwrite the stack
If we get a corrupted packet with PAYLOAD_LENGTH > FRAME_MAXSIZE, we will silently overwrite the stack. Cc: stable@vger.kernel.org Signed-off-by: Oleksij Rempel <external.Oleksij.Rempel@de.bosch.com> Signed-off-by: Dirk Behme <dirk.behme@de.bosch.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'drivers/input')
-rw-r--r--drivers/input/touchscreen/zforce_ts.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/input/touchscreen/zforce_ts.c b/drivers/input/touchscreen/zforce_ts.c
index f58a196521a9..80285c71786e 100644
--- a/drivers/input/touchscreen/zforce_ts.c
+++ b/drivers/input/touchscreen/zforce_ts.c
@@ -429,7 +429,7 @@ static int zforce_read_packet(struct zforce_ts *ts, u8 *buf)
goto unlock;
}
- if (buf[PAYLOAD_LENGTH] == 0) {
+ if (buf[PAYLOAD_LENGTH] == 0 || buf[PAYLOAD_LENGTH] > FRAME_MAXSIZE) {
dev_err(&client->dev, "invalid payload length: %d\n",
buf[PAYLOAD_LENGTH]);
ret = -EIO;