[kernel/f19] CVE-2014-3181 HID: OOB write in magicmouse driver (rhbz 1141173 1141179)

Josh Boyer jwboyer at fedoraproject.org
Fri Sep 12 16:46:47 UTC 2014


commit eecfe9602d94b2445ab55618a69c5ddb23447eaf
Author: Josh Boyer <jwboyer at fedoraproject.org>
Date:   Fri Sep 12 12:43:27 2014 -0400

    CVE-2014-3181 HID: OOB write in magicmouse driver (rhbz 1141173 1141179)

 ...use-sanity-check-report-size-in-raw_event.patch |   51 ++++++++++++++++++++
 kernel.spec                                        |    9 ++++
 2 files changed, 60 insertions(+), 0 deletions(-)
---
diff --git a/HID-magicmouse-sanity-check-report-size-in-raw_event.patch b/HID-magicmouse-sanity-check-report-size-in-raw_event.patch
new file mode 100644
index 0000000..32863af
--- /dev/null
+++ b/HID-magicmouse-sanity-check-report-size-in-raw_event.patch
@@ -0,0 +1,51 @@
+From c54def7bd64d7c0b6993336abcffb8444795bf38 Mon Sep 17 00:00:00 2001
+From: Jiri Kosina <jkosina at suse.cz>
+Date: Wed, 27 Aug 2014 09:12:24 +0200
+Subject: [PATCH] HID: magicmouse: sanity check report size in raw_event()
+ callback
+
+The report passed to us from transport driver could potentially be
+arbitrarily large, therefore we better sanity-check it so that
+magicmouse_emit_touch() gets only valid values of raw_id.
+
+Bugzilla: 1141179
+Upstream-status: 3.17 and CC'd stable
+
+Cc: stable at vger.kernel.org
+Reported-by: Steven Vittitoe <scvitti at google.com>
+Signed-off-by: Jiri Kosina <jkosina at suse.cz>
+---
+ drivers/hid/hid-magicmouse.c | 10 ++++++++++
+ 1 file changed, 10 insertions(+)
+
+diff --git a/drivers/hid/hid-magicmouse.c b/drivers/hid/hid-magicmouse.c
+index ecc2cbf300cc..29a74c1efcb8 100644
+--- a/drivers/hid/hid-magicmouse.c
++++ b/drivers/hid/hid-magicmouse.c
+@@ -290,6 +290,11 @@ static int magicmouse_raw_event(struct hid_device *hdev,
+ 		if (size < 4 || ((size - 4) % 9) != 0)
+ 			return 0;
+ 		npoints = (size - 4) / 9;
++		if (npoints > 15) {
++			hid_warn(hdev, "invalid size value (%d) for TRACKPAD_REPORT_ID\n",
++					size);
++			return 0;
++		}
+ 		msc->ntouches = 0;
+ 		for (ii = 0; ii < npoints; ii++)
+ 			magicmouse_emit_touch(msc, ii, data + ii * 9 + 4);
+@@ -307,6 +312,11 @@ static int magicmouse_raw_event(struct hid_device *hdev,
+ 		if (size < 6 || ((size - 6) % 8) != 0)
+ 			return 0;
+ 		npoints = (size - 6) / 8;
++		if (npoints > 15) {
++			hid_warn(hdev, "invalid size value (%d) for MOUSE_REPORT_ID\n",
++					size);
++			return 0;
++		}
+ 		msc->ntouches = 0;
+ 		for (ii = 0; ii < npoints; ii++)
+ 			magicmouse_emit_touch(msc, ii, data + ii * 8 + 6);
+-- 
+2.1.0
+
diff --git a/kernel.spec b/kernel.spec
index 1b7256f..c2b0345 100644
--- a/kernel.spec
+++ b/kernel.spec
@@ -759,6 +759,9 @@ Patch25130: namespaces-remount-fixes.patch
 #CVE-2014-3631 rhbz 1116347
 Patch26020: KEYS-Fix-termination-condition-in-assoc-array-garbag.patch
 
+#CVE-2014-3181 rhbz 1141179 1141173
+Patch26024: HID-magicmouse-sanity-check-report-size-in-raw_event.patch
+
 # END OF PATCH DEFINITIONS
 
 %endif
@@ -1460,6 +1463,9 @@ ApplyPatch namespaces-remount-fixes.patch
 #CVE-2014-3631 rhbz 1116347
 ApplyPatch KEYS-Fix-termination-condition-in-assoc-array-garbag.patch
 
+#CVE-2014-3181 rhbz 1141179 1141173
+ApplyPatch HID-magicmouse-sanity-check-report-size-in-raw_event.patch
+
 # END OF PATCH APPLICATIONS
 
 %endif
@@ -2272,6 +2278,9 @@ fi
 # and build.
 
 %changelog
+* Fri Sep 12 2014 Josh Boyer <jwboyer at fedoraproject.org>
+- CVE-2014-3181 HID: OOB write in magicmouse driver (rhbz 1141173 1141179)
+
 * Wed Sep 10 2014 Josh Boyer <jwboyer at fedoraproject.org>
 - CVE-2014-3631 Add patch to fix oops on keyring gc (rhbz 1116347)
 


More information about the scm-commits mailing list