Patch "USB: core: prevent malicious bNumInterfaces overflow" has been added to the 4.9-stable tree
Subsystems (2)
This is a note to let you know that I've just added the patch titled
USB: core: prevent malicious bNumInterfaces overflow
to the 4.9-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
usb-core-prevent-malicious-bnuminterfaces-overflow.patch
and it can be found in the queue-4.9 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From
48a4ff1c7bb5a32d2e396b03132d20d552c0eca7Mon Sep 17 00:00:00 2001
From: Alan Stern <[email protected]>
Date: Tue, 12 Dec 2017 14:25:13 -0500
Subject: USB: core: prevent malicious bNumInterfaces overflow
From: Alan Stern <[email protected]>
commit 48a4ff1c7bb5a32d2e396b03132d20d552c0eca7 upstream.
A malicious USB device with crafted descriptors can cause the kernel to access unallocated memory by setting the bNumInterfaces value too high in a configuration descriptor. Although the value is adjusted during parsing, this adjustment is skipped in one of the error return paths.
This patch prevents the problem by setting bNumInterfaces to 0 initially. The existing code already sets it to the proper value after parsing is complete.
--- drivers/usb/core/config.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/usb/core/config.c +3 -1
@@ -550,6 +550,9 @@ static int usb_parse_configuration(strucunsigned iad_num =0 ;memcpy (&config->desc, buffer,USB_DT_CONFIG_SIZE ); + nintf = nintf_orig = config->desc.bNumInterfaces; + config->desc.bNumInterfaces =0 ;// Adjusted later +if (config->desc.bDescriptorType !=USB_DT_CONFIG || config->desc.bLength <USB_DT_CONFIG_SIZE || config->desc.bLength > size) {
@@ -563,7 +566,6 @@ static int usb_parse_configuration(struc buffer += config->desc.bLength; size -= config->desc.bLength; - nintf = nintf_orig = config->desc.bNumInterfaces;if (nintf >USB_MAXINTERFACES ) { dev_warn(ddev, "config %d has too many interfaces: %d, " "using maximum allowed: %d\n",
Patches currently in stable-queue which might be from [email protected] are
queue-4.9/usb-core-prevent-malicious-bnuminterfaces-overflow.patch queue-4.9/usb-uas-and-storage-add-us_fl_broken_fua-for-another-jmicron-jms567-id.patch