linux/drivers/usb
William Wu b43b8174c1 usb: gadget: composite: fix dead lock when uvc disconnect
When test uvc hotplug, it may caused a dead lock in the
following case:

1. Test on Rockchip platforms used USB DWC2 controller.
2. Set USB as UVC gadget and connect to PC.
3. Open UVC to preview picture, and then disconnect USB.

Then a dead lock happens.

1. usb_function_deactivate() hold the cdev->lock;
2. usb_function_deactivate() --> usb_gadget_deactivate()
   --> usb_gadget_disconnect() --> dwc2_hsotg_disconnect()
   --> composite_disconnect() try to get the cdev->lock again.

According to the comment for cdev->lock, it's used to protect
deactivations and delayed_status count, so we can drop the
spinlock safely before do usb_gadget_deactivate(), and hold
the spinlock again after usb_gadget_deactivate() done to
protect the deactivations.

Change-Id: I24310434f0a11f9e981817de5e31b36cdbad7344
Signed-off-by: William Wu <william.wu@rock-chips.com>
2019-11-14 11:17:26 +08:00
..
atm BACKPORT: USB: add missing SPDX lines to Kconfig and Makefiles 2019-05-16 19:19:54 +08:00
c67x00
chipidea Merge remote branch 'android-4.19' of https://android.googlesource.com/kernel/common 2019-10-28 20:26:28 +08:00
class Merge remote branch 'android-4.19' of https://android.googlesource.com/kernel/common 2019-10-28 20:26:28 +08:00
common usb: common: Consider only available nodes for dr_mode 2019-04-03 06:26:27 +02:00
core usb: quirks: add quirk for Kingston DataTraveler 3.0 with broken LPM 2019-11-14 11:15:51 +08:00
dwc_otg_310 usb: dwc_otg_310: pcd: don't set pullup twice 2018-11-29 20:49:49 +08:00
dwc2 Merge remote branch 'android-4.19' of https://android.googlesource.com/kernel/common 2019-10-28 20:26:28 +08:00
dwc3 usb: dwc3: gadget: support to resize TxFIFOs dynamically 2019-11-14 11:17:26 +08:00
early
gadget usb: gadget: composite: fix dead lock when uvc disconnect 2019-11-14 11:17:26 +08:00
host CHROMIUM: xhci: stop roothub port polling timer in shutdown 2019-11-14 11:15:51 +08:00
image Merge remote branch 'android-4.19' of https://android.googlesource.com/kernel/common 2019-10-28 20:26:28 +08:00
isp1760 BACKPORT: USB: add missing SPDX lines to Kconfig and Makefiles 2019-05-16 19:19:54 +08:00
misc Merge remote branch 'android-4.19' of https://android.googlesource.com/kernel/common 2019-10-28 20:26:28 +08:00
mon BACKPORT: USB: add missing SPDX lines to Kconfig and Makefiles 2019-05-16 19:19:54 +08:00
mtu3 Merge remote branch 'android-4.19' of https://android.googlesource.com/kernel/common 2019-06-22 22:26:14 +08:00
musb Merge remote branch 'android-4.19' of https://android.googlesource.com/kernel/common 2019-06-22 22:26:14 +08:00
phy Merge remote branch 'android-4.19' of https://android.googlesource.com/kernel/common 2019-06-22 22:26:14 +08:00
renesas_usbhs usb: renesas_usbhs: gadget: Fix usb_ep_set_{halt,wedge}() behavior 2019-10-17 13:45:06 -07:00
roles BACKPORT: USB: add missing SPDX lines to Kconfig and Makefiles 2019-05-16 19:19:54 +08:00
serial usbnet: Use lte%d interface name for 4g modem 2019-11-08 14:45:33 +08:00
storage usb: uas: ignore UAS for Seagate Expansion Portable Drive 2019-11-14 11:15:51 +08:00
typec Merge remote branch 'android-4.19' of https://android.googlesource.com/kernel/common 2019-10-28 20:26:28 +08:00
usbip Merge remote branch 'android-4.19' of https://android.googlesource.com/kernel/common 2019-06-22 22:26:14 +08:00
wusbcore BACKPORT: USB: add missing SPDX lines to Kconfig and Makefiles 2019-05-16 19:19:54 +08:00
Kconfig BACKPORT: USB: add missing SPDX lines to Kconfig and Makefiles 2019-05-16 19:19:54 +08:00
Makefile rk: revert to v4.4 2019-02-10 00:33:21 +08:00
README
usb-skeleton.c USB: usb-skeleton: fix NULL-deref on disconnect 2019-10-17 13:44:50 -07:00

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.