Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2993638AbbHHWSZ (ORCPT ); Sat, 8 Aug 2015 18:18:25 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:36497 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2993072AbbHHWSI (ORCPT ); Sat, 8 Aug 2015 18:18:08 -0400 From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Oleksij Rempel , Dirk Behme , Dmitry Torokhov Subject: [PATCH 4.1 076/123] Input: zforce - dont overwrite the stack Date: Sat, 8 Aug 2015 15:09:14 -0700 Message-Id: <20150808220720.450038366@linuxfoundation.org> X-Mailer: git-send-email 2.5.0 In-Reply-To: <20150808220717.771230091@linuxfoundation.org> References: <20150808220717.771230091@linuxfoundation.org> User-Agent: quilt/0.64 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1290 Lines: 38 4.1-stable review patch. If anyone has any objections, please let me know. ------------------ 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: Greg Kroah-Hartman --- drivers/input/touchscreen/zforce_ts.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/input/touchscreen/zforce_ts.c +++ b/drivers/input/touchscreen/zforce_ts.c @@ -430,7 +430,7 @@ static int zforce_read_packet(struct zfo 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; -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/