From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757275AbbH0WYW (ORCPT ); Thu, 27 Aug 2015 18:24:22 -0400 Received: from mail-pa0-f54.google.com ([209.85.220.54]:32839 "EHLO mail-pa0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753615AbbH0WYS (ORCPT ); Thu, 27 Aug 2015 18:24:18 -0400 User-Agent: K-9 Mail for Android In-Reply-To: <1440713521-5906-17-git-send-email-kamal@canonical.com> References: <1440713521-5906-1-git-send-email-kamal@canonical.com> <1440713521-5906-17-git-send-email-kamal@canonical.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Subject: Re: [PATCH 3.19.y-ckt 016/130] Input: zforce - don't overwrite the stack From: Dmitry Torokhov Date: Thu, 27 Aug 2015 15:24:10 -0700 To: Kamal Mostafa , linux-kernel@vger.kernel.org, stable@vger.kernel.org, kernel-team@lists.ubuntu.com CC: Oleksij Rempel , Dirk Behme Message-ID: <5F09152C-B909-4513-B3E5-AA3933560350@gmail.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On August 27, 2015 3:10:07 PM PDT, Kamal Mostafa wrote: >3.19.8-ckt6 -stable review patch. If anyone has any objections, please >let me know. Bad patch, reverted in mainline, please drop. > >------------------ > >From: Oleksij Rempel > >commit 7d01cd261c76f95913c81554a751968a1d282d3a upstream. > >If we get a corrupted packet with PAYLOAD_LENGTH > FRAME_MAXSIZE, we >will silently overwrite the stack. > >Signed-off-by: Oleksij Rempel >Signed-off-by: Dirk Behme >Signed-off-by: Dmitry Torokhov >Signed-off-by: Kamal Mostafa >--- > drivers/input/touchscreen/zforce_ts.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > >diff --git a/drivers/input/touchscreen/zforce_ts.c >b/drivers/input/touchscreen/zforce_ts.c >index 19880c7..a9e1ee3 100644 >--- a/drivers/input/touchscreen/zforce_ts.c >+++ b/drivers/input/touchscreen/zforce_ts.c >@@ -430,7 +430,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; Thanks. -- Dmitry