subsys: usb: check for invalid descriptor type request
Implementation of Get Descriptor Request should not return interface or endpoint descriptors in a single request without configuration descriptor, see USB Spec. Revision 2.0, 9.4.3 Get Descriptor This patch fixes linux kernel usbtest subtest 7 and subtest 11 errors. Signed-off-by: Johann Fischer <j.fischer@phytec.de>
This commit is contained in:
parent
9af44d8256
commit
4b0b65c1b8
|
@ -389,6 +389,15 @@ static bool usb_get_descriptor(u16_t type_index, u16_t lang_id,
|
|||
type = GET_DESC_TYPE(type_index);
|
||||
index = GET_DESC_INDEX(type_index);
|
||||
|
||||
/*
|
||||
* Invalid types of descriptors,
|
||||
* see USB Spec. Revision 2.0, 9.4.3 Get Descriptor
|
||||
*/
|
||||
if ((type == DESC_INTERFACE) || (type == DESC_ENDPOINT) ||
|
||||
(type > DESC_OTHER_SPEED)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
p = (u8_t *)usb_dev.descriptors;
|
||||
cur_index = 0;
|
||||
|
||||
|
|
Loading…
Reference in a new issue