Subject: CVE-2023-52781: usb: config: fix iteration issue in 'usb_get_bos_descriptor()'

From: Greg Kroah-Hartman <[email-masked]>

Description
===========

In the Linux kernel, the following vulnerability has been resolved:

usb: config: fix iteration issue in 'usb_get_bos_descriptor()'

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.

The Linux kernel CVE team has assigned CVE-2023-52781 to this issue.

Affected and fixed versions
===========================

	Issue introduced in 5.4 with commit 3dd550a2d365 and fixed in 5.10.203 with commit 9ef94ec8e52e
	Issue introduced in 5.4 with commit 3dd550a2d365 and fixed in 5.15.142 with commit 64c27b7b2357
	Issue introduced in 5.4 with commit 3dd550a2d365 and fixed in 6.1.66 with commit f89fef7710b2
	Issue introduced in 5.4 with commit 3dd550a2d365 and fixed in 6.6.4 with commit 7c0244cc311a
	Issue introduced in 5.4 with commit 3dd550a2d365 and fixed in 6.7 with commit 974bba5c118f
	Issue introduced in 3.16.79 with commit 77ce180d68be
	Issue introduced in 4.4.194 with commit 20a07e1aadcd
	Issue introduced in 4.9.194 with commit a5c051b6503c
	Issue introduced in 4.14.146 with commit ea4a173d8358
	Issue introduced in 4.19.75 with commit 77d4e2a05885
	Issue introduced in 5.2.17 with commit 1fc15d29540a
	Issue introduced in 5.3.1 with commit 9f8dd40c68c1

Please see https://www.kernel.org for a full list of currently supported
kernel versions by the kernel community.

Unaffected versions might change over time as fixes are backported to
older supported kernel versions.  The official CVE entry at
	https://cve.org/CVERecord/?id=CVE-2023-52781
will be updated if fixes are backported, please check that for the most
up to date information about this issue.

Affected files
==============

The file(s) affected by this issue are:
	drivers/usb/core/config.c

Mitigation
==========

The Linux kernel CVE team recommends that you update to the latest
stable kernel version for this, and many other bugfixes.  Individual
changes are never tested alone, but rather are part of a larger kernel
release.  Cherry-picking individual commits is not recommended or
supported by the Linux kernel community at all.  If however, updating to
the latest release is impossible, the individual changes to resolve this
issue can be found at these commits:
	https://git.kernel.org/stable/c/9ef94ec8e52eaf7b9abc5b5f8f5b911751112223
	https://git.kernel.org/stable/c/64c27b7b2357ddb38b6afebaf46d5bff4d250702
	https://git.kernel.org/stable/c/f89fef7710b2ba0f7a1e46594e530dcf2f77be91
	https://git.kernel.org/stable/c/7c0244cc311a4038505b73682b7c8ceaa5c7a8c8
	https://git.kernel.org/stable/c/974bba5c118f4c2baf00de0356e3e4f7928b4cbc