linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 12/14] HID: sensor-hub: validate feature report details
@ 2013-08-28 20:31 Jiri Kosina
  2013-08-28 20:42 ` Srinivas Pandruvada
  2013-08-29 10:03 ` Mika Westerberg
  0 siblings, 2 replies; 10+ messages in thread
From: Jiri Kosina @ 2013-08-28 20:31 UTC (permalink / raw)
  To: linux-input; +Cc: Kees Cook, Mika Westerberg, srinivas pandruvada

From: Kees Cook <keescook@chromium.org>

A HID device could send a malicious feature report that would cause the
sensor-hub HID driver to read past the end of heap allocation, leaking
kernel memory contents to the caller.

CVE-2013-2898

Signed-off-by: Kees Cook <keescook@chromium.org>
Cc: stable@kernel.org
---
 drivers/hid/hid-sensor-hub.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/hid/hid-sensor-hub.c b/drivers/hid/hid-sensor-hub.c
index ca749810..aa34755 100644
--- a/drivers/hid/hid-sensor-hub.c
+++ b/drivers/hid/hid-sensor-hub.c
@@ -221,7 +221,8 @@ int sensor_hub_get_feature(struct hid_sensor_hub_device *hsdev, u32 report_id,
 
 	mutex_lock(&data->mutex);
 	report = sensor_hub_report(report_id, hsdev->hdev, HID_FEATURE_REPORT);
-	if (!report || (field_index >=  report->maxfield)) {
+	if (!report || (field_index >=  report->maxfield) ||
+	    report->field[field_index]->report_count < 1) {
 		ret = -EINVAL;
 		goto done_proc;
 	}
-- 
Jiri Kosina
SUSE Labs

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2013-09-04 18:26 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-28 20:31 [PATCH 12/14] HID: sensor-hub: validate feature report details Jiri Kosina
2013-08-28 20:42 ` Srinivas Pandruvada
2013-08-28 20:42   ` Jiri Kosina
2013-08-28 21:16     ` Kees Cook
2013-08-29 18:13       ` Srinivas Pandruvada
2013-08-29 19:47         ` Kees Cook
2013-08-29 10:03 ` Mika Westerberg
2013-09-04 16:05   ` Kees Cook
2013-09-04 18:14     ` Jiri Kosina
2013-09-04 18:26       ` Kees Cook

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).