]> www.infradead.org Git - users/jedix/linux-maple.git/commit
USB: core: prevent malicious bNumInterfaces overflow
authorAlan Stern <stern@rowland.harvard.edu>
Tue, 12 Dec 2017 19:25:13 +0000 (14:25 -0500)
committerBrian Maly <brian.maly@oracle.com>
Mon, 23 Apr 2018 19:30:05 +0000 (15:30 -0400)
commit31704a11616772b69841a6d811fb82e577efc4fe
tree4a580791b71e68d4cfd5cff33ec405df19c292ac
parente785e78c81b9387ab9619a120a9859ddef904644
USB: core: prevent malicious bNumInterfaces overflow

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.

Orabug: 27895909

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Reported-by: Andrey Konovalov <andreyknvl@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 4c5ae6a301a5415d1334f6c655bebf91d475bd89)
Signed-off-by: Srinivas Eeda <srinivas.eeda@oracle.com>
Reviewed-by: junxiao.bi@oracle.com
Reviewed-by: jack.schwartz@oracle.com
Signed-off-by: Brian Maly <brian.maly@oracle.com>
drivers/usb/core/config.c