[linux] 01/01: HID: hiddev: validate num_values for HIDIOCGUSAGES, HIDIOCSUSAGES commands (CVE-2016-5829)
debian-kernel at lists.debian.org
debian-kernel at lists.debian.org
Thu Jun 30 12:54:41 UTC 2016
This is an automated email from the git hooks/post-receive script.
carnil pushed a commit to branch sid
in repository linux.
commit 3c35987b0584b3a83bdd752b709fbfd1cda59a72
Author: Salvatore Bonaccorso <carnil at debian.org>
Date: Thu Jun 30 14:49:56 2016 +0200
HID: hiddev: validate num_values for HIDIOCGUSAGES, HIDIOCSUSAGES commands (CVE-2016-5829)
---
debian/changelog | 5 +++
...validate-num_values-for-HIDIOCGUSAGES-HID.patch | 44 ++++++++++++++++++++++
debian/patches/series | 1 +
3 files changed, 50 insertions(+)
diff --git a/debian/changelog b/debian/changelog
index 323cb73..126691b 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,5 +1,6 @@
linux (4.6.3-1) UNRELEASED; urgency=medium
+ [ Ben Hutchings ]
* New upstream stable update:
https://www.kernel.org/pub/linux/kernel/v4.x/ChangeLog-4.6.3
- scsi_lib: correctly retry failed zero length REQ_TYPE_FS commands
@@ -67,6 +68,10 @@ linux (4.6.3-1) UNRELEASED; urgency=medium
- [x86] Revert "drm/i915: Exit cherryview_irq_handler() after one pass"
- gpio: make sure gpiod_to_irq() returns negative on NULL desc
+ [ Salvatore Bonaccorso ]
+ * HID: hiddev: validate num_values for HIDIOCGUSAGES, HIDIOCSUSAGES commands
+ (CVE-2016-5829)
+
-- Ben Hutchings <ben at decadent.org.uk> Mon, 27 Jun 2016 00:31:11 +0200
linux (4.6.2-2) unstable; urgency=medium
diff --git a/debian/patches/bugfix/all/HID-hiddev-validate-num_values-for-HIDIOCGUSAGES-HID.patch b/debian/patches/bugfix/all/HID-hiddev-validate-num_values-for-HIDIOCGUSAGES-HID.patch
new file mode 100644
index 0000000..e5e4cec
--- /dev/null
+++ b/debian/patches/bugfix/all/HID-hiddev-validate-num_values-for-HIDIOCGUSAGES-HID.patch
@@ -0,0 +1,44 @@
+From: Scott Bauer <sbauer at plzdonthack.me>
+Date: Thu, 23 Jun 2016 08:59:47 -0600
+Subject: HID: hiddev: validate num_values for HIDIOCGUSAGES, HIDIOCSUSAGES
+ commands
+Origin: https://git.kernel.org/linus/93a2001bdfd5376c3dc2158653034c20392d15c5
+
+This patch validates the num_values parameter from userland during the
+HIDIOCGUSAGES and HIDIOCSUSAGES commands. Previously, if the report id was set
+to HID_REPORT_ID_UNKNOWN, we would fail to validate the num_values parameter
+leading to a heap overflow.
+
+Cc: stable at vger.kernel.org
+Signed-off-by: Scott Bauer <sbauer at plzdonthack.me>
+Signed-off-by: Jiri Kosina <jkosina at suse.cz>
+---
+ drivers/hid/usbhid/hiddev.c | 10 +++++-----
+ 1 file changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/drivers/hid/usbhid/hiddev.c b/drivers/hid/usbhid/hiddev.c
+index 2f1ddca..700145b 100644
+--- a/drivers/hid/usbhid/hiddev.c
++++ b/drivers/hid/usbhid/hiddev.c
+@@ -516,13 +516,13 @@ static noinline int hiddev_ioctl_usage(struct hiddev *hiddev, unsigned int cmd,
+ goto inval;
+ } else if (uref->usage_index >= field->report_count)
+ goto inval;
+-
+- else if ((cmd == HIDIOCGUSAGES || cmd == HIDIOCSUSAGES) &&
+- (uref_multi->num_values > HID_MAX_MULTI_USAGES ||
+- uref->usage_index + uref_multi->num_values > field->report_count))
+- goto inval;
+ }
+
++ if ((cmd == HIDIOCGUSAGES || cmd == HIDIOCSUSAGES) &&
++ (uref_multi->num_values > HID_MAX_MULTI_USAGES ||
++ uref->usage_index + uref_multi->num_values > field->report_count))
++ goto inval;
++
+ switch (cmd) {
+ case HIDIOCGUSAGE:
+ uref->value = field->value[uref->usage_index];
+--
+2.8.1
+
diff --git a/debian/patches/series b/debian/patches/series
index 7315a62..50cedef 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -113,6 +113,7 @@ bugfix/all/percpu-fix-synchronization-between-chunk-map_extend_.patch
bugfix/all/percpu-fix-synchronization-between-synchronous-map-e.patch
bugfix/all/posix_acl-add-set_posix_acl.patch
bugfix/all/nfsd-check-permissions-when-setting-acls.patch
+bugfix/all/HID-hiddev-validate-num_values-for-HIDIOCGUSAGES-HID.patch
# ABI maintenance
debian/mips-siginfo-fix-abi-change-in-4.6.2.patch
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/kernel/linux.git
More information about the Kernel-svn-changes
mailing list