USB: fix out-of-bounds in usb_set_configuration
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 19 Sep 2017 13:07:17 +0000 (15:07 +0200)
committerBen Hutchings <ben@decadent.org.uk>
Sat, 11 Nov 2017 13:34:40 +0000 (13:34 +0000)
commita0e0a5850211dd09725c819a8915c2cbe9067317
tree90a466149babf1bf7b8ab15487bd69eb4d5f24bb
parent8a930044f0b100d6b28a94525e9cf62787b3ec3a
USB: fix out-of-bounds in usb_set_configuration

commit bd7a3fe770ebd8391d1c7d072ff88e9e76d063eb upstream.

Andrey Konovalov reported a possible out-of-bounds problem for a USB interface
association descriptor.  He writes:
It seems there's no proper size check of a USB_DT_INTERFACE_ASSOCIATION
descriptor. It's only checked that the size is >= 2 in
usb_parse_configuration(), so find_iad() might do out-of-bounds access
to intf_assoc->bInterfaceCount.

And he's right, we don't check for crazy descriptors of this type very well, so
resolve this problem.  Yet another issue found by syzkaller...

Reported-by: Andrey Konovalov <andreyknvl@google.com>
Tested-by: Andrey Konovalov <andreyknvl@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[bwh: Backported to 3.2: adjust filename]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
drivers/usb/core/config.c
include/linux/usb/ch9.h