mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-24 19:12:14 +00:00
USB: core: Add type-specific length check of BOS descriptors
commit 81cf4a4536 upstream.
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
34ba2f04a4
commit
05ffc7ed55
@@ -854,6 +854,8 @@ struct usb_wireless_cap_descriptor { /* Ultra Wide Band */
|
||||
__u8 bReserved;
|
||||
} __attribute__((packed));
|
||||
|
||||
#define USB_DT_USB_WIRELESS_CAP_SIZE 11
|
||||
|
||||
/* USB 2.0 Extension descriptor */
|
||||
#define USB_CAP_TYPE_EXT 2
|
||||
|
||||
@@ -1046,6 +1048,7 @@ struct usb_ptm_cap_descriptor {
|
||||
__u8 bDevCapabilityType;
|
||||
} __attribute__((packed));
|
||||
|
||||
#define USB_DT_USB_PTM_ID_SIZE 3
|
||||
/*
|
||||
* The size of the descriptor for the Sublink Speed Attribute Count
|
||||
* (SSAC) specified in bmAttributes[4:0].
|
||||
|
||||
Reference in New Issue
Block a user