Patch "usb: config: fix iteration issue in 'usb_get_bos_descriptor()'" has been added to the 5.10-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

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

to the 5.10-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     usb-config-fix-iteration-issue-in-usb_get_bos_descri.patch
and it can be found in the queue-5.10 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 296faafe59e3b705184d4b31bb9f5237b6deec25
Author: Niklas Neronin <niklas.neronin@xxxxxxxxxxxxxxx>
Date:   Wed Nov 15 14:13:25 2023 +0200

    usb: config: fix iteration issue in 'usb_get_bos_descriptor()'
    
    [ Upstream commit 974bba5c118f4c2baf00de0356e3e4f7928b4cbc ]
    
    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@xxxxxxxxxxxxxxx
    Fixes: 3dd550a2d365 ("USB: usbcore: Fix slab-out-of-bounds bug during device reset")
    Signed-off-by: Niklas Neronin <niklas.neronin@xxxxxxxxxxxxxxx>
    Acked-by: Mathias Nyman <mathias.nyman@xxxxxxxxxxxxxxx>
    Reviewed-by: Alan Stern <stern@xxxxxxxxxxxxxxxxxxx>
    Link: https://lore.kernel.org/r/20231115121325.471454-1-niklas.neronin@xxxxxxxxxxxxxxx
    Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/usb/core/config.c b/drivers/usb/core/config.c
index 1e40e63d301bd..2f8a1225b6976 100644
--- a/drivers/usb/core/config.c
+++ b/drivers/usb/core/config.c
@@ -1047,7 +1047,7 @@ int usb_get_bos_descriptor(struct usb_device *dev)
 
 		if (cap->bDescriptorType != USB_DT_DEVICE_CAPABILITY) {
 			dev_notice(ddev, "descriptor type invalid, skip\n");
-			continue;
+			goto skip_to_next_descriptor;
 		}
 
 		switch (cap_type) {
@@ -1080,6 +1080,7 @@ int usb_get_bos_descriptor(struct usb_device *dev)
 			break;
 		}
 
+skip_to_next_descriptor:
 		total_len -= length;
 		buffer += length;
 	}



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux