]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
USB: core: Change usb_get_device_descriptor() API
authorAlan Stern <stern@rowland.harvard.edu>
Fri, 4 Aug 2023 19:12:21 +0000 (15:12 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 19 Sep 2023 10:22:53 +0000 (12:22 +0200)
commiteda9a296658203b1cc07d777c19c8c9eac6d0d17
tree0ad5a8bb684d21bf640b41ef69ecb6e140c22f70
parent56c49a3328e988c82981f4d098be22695d46fcf3
USB: core: Change usb_get_device_descriptor() API

commit de28e469da75359a2bb8cd8778b78aa64b1be1f4 upstream.

The usb_get_device_descriptor() routine reads the device descriptor
from the udev device and stores it directly in udev->descriptor.  This
interface is error prone, because the USB subsystem expects in-memory
copies of a device's descriptors to be immutable once the device has
been initialized.

The interface is changed so that the device descriptor is left in a
kmalloc-ed buffer, not copied into the usb_device structure.  A
pointer to the buffer is returned to the caller, who is then
responsible for kfree-ing it.  The corresponding changes needed in the
various callers are fairly small.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Link: https://lore.kernel.org/r/d0111bb6-56c1-4f90-adf2-6cfe152f6561@rowland.harvard.edu
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/core/hcd.c
drivers/usb/core/hub.c
drivers/usb/core/message.c
drivers/usb/core/usb.h