All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jiri Kosina <jkosina@suse.cz>
To: linux-input@vger.kernel.org
Cc: Kees Cook <keescook@chromium.org>,
	Mika Westerberg <mika.westerberg@linux.intel.com>,
	srinivas pandruvada <srinivas.pandruvada@intel.com>
Subject: [PATCH 12/14] HID: sensor-hub: validate feature report details
Date: Wed, 28 Aug 2013 22:31:44 +0200 (CEST)	[thread overview]
Message-ID: <alpine.LNX.2.00.1308282222190.22181@pobox.suse.cz> (raw)

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

             reply	other threads:[~2013-08-28 20:31 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-28 20:31 Jiri Kosina [this message]
2013-08-28 20:42 ` [PATCH 12/14] HID: sensor-hub: validate feature report details 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.LNX.2.00.1308282222190.22181@pobox.suse.cz \
    --to=jkosina@suse.cz \
    --cc=keescook@chromium.org \
    --cc=linux-input@vger.kernel.org \
    --cc=mika.westerberg@linux.intel.com \
    --cc=srinivas.pandruvada@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.