summaryrefslogtreecommitdiffstats
path: root/drivers/usb/cdns3
diff options
context:
space:
mode:
authorYuta Hayama <hayama@lineo.co.jp>2023-02-28 09:56:37 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-03-09 15:34:21 +0100
commit180bb831b232b43bbd658dcdb20a49020059c1b8 (patch)
tree34ef329f5c0990b7bdbbbcbfdfc1aea9e235e5c8 /drivers/usb/cdns3
parentusb: gadget: udc: replace kzalloc with devm_kzalloc in mv_udc_probe (diff)
downloadlinux-180bb831b232b43bbd658dcdb20a49020059c1b8.tar.xz
linux-180bb831b232b43bbd658dcdb20a49020059c1b8.zip
usb: gadget: f_fs: Fix incorrect version checking of OS descs
Currently, the USB gadget framework supports only version 1.0 of the MS OS descriptor. OS desc has a field bcdVersion indicating its version, with v1.0 represented by the value 0x100. However, __ffs_do_os_desc_header() was expecting the incorrect value 0x1, so allow the correct value 0x100. The bcdVersion field of the descriptor that is actually sent to the host is set by composite_setup() (in composite.c) to the fixed value 0x100. Therefore, it can be understood that __ffs_do_os_desc_header() is only performing a format check of the OS desc passed to functionfs. If a value other than 0x100 is accepted, there is no effect on communication over the USB bus. Indeed, until now __ffs_do_os_desc_header() has only accepted the incorrect value 0x1, but there was no problem with the communication over the USB bus. However, this can be confusing for functionfs userspace drivers. Since bcdVersion=0x100 is used in actual communication, functionfs should accept the value 0x100. Note that the correct value for bcdVersion in OS desc v1.0 is 0x100, but to avoid breaking old userspace drivers, the value 0x1 is also accepted as an exception. At this time, a message is output to notify the user to fix the userspace driver. Signed-off-by: Yuta Hayama <hayama@lineo.co.jp> Reviewed-by: Andrzej Pietrasiewicz <andrzej.p@collabora.com> Link: https://lore.kernel.org/r/290f96db-1877-5137-373a-318e7b4f2dde@lineo.co.jp Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/cdns3')
0 files changed, 0 insertions, 0 deletions