[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <5bc00ccfce098d09c1aa097806660d9709fbe956.1485514374.git.jslaby@suse.cz>
Date: Fri, 27 Jan 2017 11:54:35 +0100
From: Jiri Slaby <jslaby@...e.cz>
To: stable@...r.kernel.org
Cc: linux-kernel@...r.kernel.org,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Jiri Slaby <jslaby@...e.cz>, Jiri Kosina <jkosina@...e.cz>
Subject: [PATCH 3.12 142/235] HID: hid-cypress: validate length of report
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 1ebb71143758f45dc0fa76e2f48429e13b16d110 upstream.
Make sure we have enough of a report structure to validate before
looking at it.
Reported-by: Benoit Camredon <benoit.camredon@...bus.com>
Tested-by: Benoit Camredon <benoit.camredon@...bus.com>
Signed-off-by: Jiri Slaby <jslaby@...e.cz>
Signed-off-by: Jiri Kosina <jkosina@...e.cz>
---
drivers/hid/hid-cypress.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/hid/hid-cypress.c b/drivers/hid/hid-cypress.c
index c4ef3bc726e3..e299576004ce 100644
--- a/drivers/hid/hid-cypress.c
+++ b/drivers/hid/hid-cypress.c
@@ -39,6 +39,9 @@ static __u8 *cp_report_fixup(struct hid_device *hdev, __u8 *rdesc,
if (!(quirks & CP_RDESC_SWAPPED_MIN_MAX))
return rdesc;
+ if (*rsize < 4)
+ return rdesc;
+
for (i = 0; i < *rsize - 4; i++)
if (rdesc[i] == 0x29 && rdesc[i + 2] == 0x19) {
__u8 tmp;
--
2.11.0
Powered by blists - more mailing lists