Commit 32084101 authored by Niklas Neronin's avatar Niklas Neronin Committed by Zheng Zengkai
Browse files

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

stable inclusion
from stable-v6.6.4
commit 7c0244cc311a4038505b73682b7c8ceaa5c7a8c8
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I8N1WC

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=7c0244cc311a4038505b73682b7c8ceaa5c7a8c8



--------------------------------

commit 974bba5c118f4c2baf00de0356e3e4f7928b4cbc upstream.

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: 3dd550a2 ("USB: usbcore: Fix slab-out-of-bounds bug during device reset")
Signed-off-by: default avatarNiklas Neronin <niklas.neronin@linux.intel.com>
Acked-by: default avatarMathias Nyman <mathias.nyman@linux.intel.com>
Reviewed-by: default avatarAlan Stern <stern@rowland.harvard.edu>
Link: https://lore.kernel.org/r/20231115121325.471454-1-niklas.neronin@linux.intel.com


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarZheng Zengkai <zhengzengkai@huawei.com>
parent 2606a87f
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment