Skip to content

Commit 40b9ac4

Browse files
author
CIQ Kernel Automation
committed
usb: config: fix iteration issue in 'usb_get_bos_descriptor()'
jira VULN-35775 cve CVE-2023-52781 commit-author Niklas Neronin <niklas.neronin@linux.intel.com> commit 974bba5 The BOS descriptor defines a root descriptor and is the base descriptor for accessing a family of related descriptors. Function 'usb_get_bos_descriptor()' encounters an iteration issue when skipping the 'USB_DT_DEVICE_CAPABILITY' descriptor type. This results in the same descriptor being read repeatedly. To address this issue, a 'goto' statement is introduced to ensure that the pointer and the amount read is updated correctly. This ensures that the function iterates to the next descriptor instead of reading the same descriptor repeatedly. Cc: stable@vger.kernel.org Fixes: 3dd550a ("USB: usbcore: Fix slab-out-of-bounds bug during device reset") Signed-off-by: Niklas Neronin <niklas.neronin@linux.intel.com> Acked-by: Mathias Nyman <mathias.nyman@linux.intel.com> Reviewed-by: Alan Stern <stern@rowland.harvard.edu> Link: https://lore.kernel.org/r/20231115121325.471454-1-niklas.neronin@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> (cherry picked from commit 974bba5) Signed-off-by: CIQ Kernel Automation <ciq_kernel_automation@ciq.com>
1 parent de5c710 commit 40b9ac4

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

drivers/usb/core/config.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1053,7 +1053,7 @@ int usb_get_bos_descriptor(struct usb_device *dev)
10531053

10541054
if (cap->bDescriptorType != USB_DT_DEVICE_CAPABILITY) {
10551055
dev_notice(ddev, "descriptor type invalid, skip\n");
1056-
continue;
1056+
goto skip_to_next_descriptor;
10571057
}
10581058

10591059
switch (cap_type) {
@@ -1084,6 +1084,7 @@ int usb_get_bos_descriptor(struct usb_device *dev)
10841084
break;
10851085
}
10861086

1087+
skip_to_next_descriptor:
10871088
total_len -= length;
10881089
buffer += length;
10891090
}

0 commit comments

Comments
 (0)