Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1568073 > unrolled thread

[PATCH 3.12 142/235] HID: hid-cypress: validate length of report

Started byJiri Slaby <jslaby@suse.cz>
First post2017-01-27 12:10 +0100
Last post2017-01-27 12:10 +0100
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 3.12 142/235] HID: hid-cypress: validate length of report Jiri Slaby <jslaby@suse.cz> - 2017-01-27 12:10 +0100

#1568073 — [PATCH 3.12 142/235] HID: hid-cypress: validate length of report

FromJiri Slaby <jslaby@suse.cz>
Date2017-01-27 12:10 +0100
Subject[PATCH 3.12 142/235] HID: hid-cypress: validate length of report
Message-ID<t4czM-3lb-21@gated-at.bofh.it>
From: Greg Kroah-Hartman <gregkh@linuxfoundation.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@airbus.com>
Tested-by: Benoit Camredon <benoit.camredon@airbus.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Jiri Kosina <jkosina@suse.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

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web