1
0
Fork 0
alistair23-linux/drivers/usb
Chris Dickens 5d6ae4f0da usb: gadget: composite: fix incorrect handling of OS desc requests
When handling an OS descriptor request, one of the first operations is
to zero out the request buffer using the wLength from the setup packet.
There is no bounds checking, so a wLength > 4096 would clobber memory
adjacent to the request buffer. Fix this by taking the min of wLength
and the request buffer length prior to the memset. While at it, define
the buffer length in a header file so that magic numbers don't appear
throughout the code.

When returning data to the host, the data length should be the min of
the wLength and the valid data we have to return. Currently we are
returning wLength, thus requests for a wLength greater than the amount
of data in the OS descriptor buffer would return invalid (albeit zero'd)
data following the valid descriptor data. Fix this by counting the
number of bytes when constructing the data and using this when
determining the length of the request.

Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2018-03-08 15:12:01 +02:00
..
atm USB: atm: fix up some remaining DEVICE_ATTR() usage 2018-01-24 08:49:52 +01:00
c67x00 USB: add SPDX identifiers to all remaining Makefiles 2017-11-07 15:53:48 +01:00
chipidea USB: move many drivers to use DEVICE_ATTR_WO 2018-01-24 08:49:52 +01:00
class usb: cdc_acm: prevent race at write to acm while system resumes 2018-02-16 07:52:55 +01:00
common USB: ulpi: fix bus-node lookup 2017-11-28 15:17:48 +01:00
core Add delay-init quirk for Corsair K70 RGB keyboards 2018-02-15 20:52:56 +01:00
dwc2 usb: dwc2: eliminate irq parameter from dwc2_gadget_init 2018-03-08 15:12:01 +02:00
dwc3 usb: dwc3: debugfs: Re-use DEFINE_SHOW_ATTRIBUTE() macro 2018-03-08 15:12:00 +02:00
early usb: early: Correct the endpoint type value for bulk in endpoint 2017-12-07 16:03:15 +01:00
gadget usb: gadget: composite: fix incorrect handling of OS desc requests 2018-03-08 15:12:01 +02:00
host USB fixes for 4.16-rc3 2018-02-22 12:13:01 -08:00
image USB/PHY patches for 4.15-rc1 2017-11-13 21:14:07 -08:00
isp1760 USB/PHY patches for 4.15-rc1 2017-11-13 21:14:07 -08:00
misc usb: ldusb: add PIDs for new CASSY devices supported by this driver 2018-02-15 18:44:03 +01:00
mon vfs: do bulk POLL* -> EPOLL* replacement 2018-02-11 14:34:03 -08:00
mtu3 usb: mtu3: fix semicolon.cocci warnings 2018-01-16 10:01:01 +01:00
musb Revert "usb: musb: host: don't start next rx urb if current one failed" 2018-02-20 15:02:46 +01:00
phy usb: phy: ab8500: use correct enum type 2018-03-08 15:12:00 +02:00
renesas_usbhs usb: renesas_usbhs: missed the "running" flag in usb_dmac with rx path 2018-02-15 18:43:57 +01:00
serial USB: serial: option: Add support for Quectel EP06 2018-02-15 18:36:19 +01:00
storage USB: move many drivers to use DEVICE_ATTR_RO 2018-01-24 08:49:52 +01:00
typec Merge 4.15-rc4 into usb-next 2017-12-18 09:08:05 +01:00
usbip usbip: keep usbip_device sockfd state in sync with tcp_socket 2018-02-15 18:43:57 +01:00
wusbcore USB/PHY patches for 4.15-rc1 2017-11-13 21:14:07 -08:00
Kconfig sparc,leon: Select USB_UHCI_BIG_ENDIAN_{MMIO,DESC} 2018-02-15 21:45:16 +00:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
README
usb-skeleton.c USB: usb-skeleton: Remove redundant license text 2017-11-04 11:55:39 +01:00

README

To understand all the Linux-USB framework, you'll use these resources:

    * This source code.  This is necessarily an evolving work, and
      includes kerneldoc that should help you get a current overview.
      ("make pdfdocs", and then look at "usb.pdf" for host side and
      "gadget.pdf" for peripheral side.)  Also, Documentation/usb has
      more information.

    * The USB 2.0 specification (from www.usb.org), with supplements
      such as those for USB OTG and the various device classes.
      The USB specification has a good overview chapter, and USB
      peripherals conform to the widely known "Chapter 9".

    * Chip specifications for USB controllers.  Examples include
      host controllers (on PCs, servers, and more); peripheral
      controllers (in devices with Linux firmware, like printers or
      cell phones); and hard-wired peripherals like Ethernet adapters.

    * Specifications for other protocols implemented by USB peripheral
      functions.  Some are vendor-specific; others are vendor-neutral
      but just standardized outside of the www.usb.org team.

Here is a list of what each subdirectory here is, and what is contained in
them.

core/		- This is for the core USB host code, including the
		  usbfs files and the hub class driver ("hub_wq").

host/		- This is for USB host controller drivers.  This
		  includes UHCI, OHCI, EHCI, and others that might
		  be used with more specialized "embedded" systems.

gadget/		- This is for USB peripheral controller drivers and
		  the various gadget drivers which talk to them.


Individual USB driver directories.  A new driver should be added to the
first subdirectory in the list below that it fits into.

image/		- This is for still image drivers, like scanners or
		  digital cameras.
../input/	- This is for any driver that uses the input subsystem,
		  like keyboard, mice, touchscreens, tablets, etc.
../media/	- This is for multimedia drivers, like video cameras,
		  radios, and any other drivers that talk to the v4l
		  subsystem.
../net/		- This is for network drivers.
serial/		- This is for USB to serial drivers.
storage/	- This is for USB mass-storage drivers.
class/		- This is for all USB device drivers that do not fit
		  into any of the above categories, and work for a range
		  of USB Class specified devices. 
misc/		- This is for all USB device drivers that do not fit
		  into any of the above categories.