OSDN Git Service

USB: core: Add type-specific length check of BOS descriptors
authorMasakazu Mokuno <masakazu.mokuno@gmail.com>
Thu, 9 Nov 2017 16:25:50 +0000 (01:25 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 28 Nov 2017 14:17:49 +0000 (15:17 +0100)
commit81cf4a45360f70528f1f64ba018d61cb5767249a
tree2a887a07dc7d4d7e10d6ee723bb1dce46ed6ac86
parent1d5a31582ef046d3b233f0da1a68ae26519b2f0a
USB: core: Add type-specific length check of BOS descriptors

As most of BOS descriptors are longer in length than their header
'struct usb_dev_cap_header', comparing solely with it is not sufficient
to avoid out-of-bounds access to BOS descriptors.

This patch adds descriptor type specific length check in
usb_get_bos_descriptor() to fix the issue.

Signed-off-by: Masakazu Mokuno <masakazu.mokuno@gmail.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/core/config.c
include/uapi/linux/usb/ch9.h