linux/drivers/usb/gadget
Alan Stern dec3c23c9a USB: net2280: Fix erroneous synchronization change
Commit f16443a034 ("USB: gadgetfs, dummy-hcd, net2280: fix locking
for callbacks") was based on a serious misunderstanding.  It
introduced regressions into both the dummy-hcd and net2280 drivers.

The problem in dummy-hcd was fixed by commit 7dbd8f4cab ("USB:
dummy-hcd: Fix erroneous synchronization change"), but the problem in
net2280 remains.  Namely: the ->disconnect(), ->suspend(), ->resume(),
and ->reset() callbacks must be invoked without the private lock held;
otherwise a deadlock will occur when the callback routine tries to
interact with the UDC driver.

This patch largely is a reversion of the relevant parts of
f16443a034.  It also drops the private lock around the calls to
->suspend() and ->resume() (something the earlier patch forgot to do).
This is safe from races with device interrupts because it occurs
within the interrupt handler.

Finally, the patch changes where the ->disconnect() callback is
invoked when net2280_pullup() turns the pullup off.  Rather than
making the callback from within stop_activity() at a time when dropping
the private lock could be unsafe, the callback is moved to a point
after the lock has already been dropped.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Fixes: f16443a034 ("USB: gadgetfs, dummy-hcd, net2280: fix locking for callbacks")
Reported-by: D. Ziesche <dziesche@zes.com>
Tested-by: D. Ziesche <dziesche@zes.com>
CC: <stable@vger.kernel.org>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2018-08-29 09:59:47 +03:00
..
function USB/PHY patches for 4.19-rc1 2018-08-18 10:21:49 -07:00
legacy usb: gadget: tcm: fix spelling mistake: "Manufactor" -> "Manufacturer" 2018-07-26 13:35:29 +03:00
udc USB: net2280: Fix erroneous synchronization change 2018-08-29 09:59:47 +03:00
composite.c usb: gadget: Fix OS descriptors support 2018-07-17 10:12:51 +03:00
config.c USB: gadget: Remove redundant license text 2017-11-07 15:45:02 +01:00
configfs.c usb: gadget: configfs: avoid spaces for indentation 2018-07-26 13:49:49 +03:00
configfs.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
epautoconf.c USB: gadget: Remove redundant license text 2017-11-07 15:45:02 +01:00
functions.c USB: add SPDX identifiers to all remaining files in drivers/usb/ 2017-11-04 11:48:02 +01:00
Kconfig Revert "usb: gadget: allow to enable legacy drivers without USB_ETH" 2017-12-12 12:48:30 +02:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
u_f.c USB: gadget: Remove redundant license text 2017-11-07 15:45:02 +01:00
u_f.h USB: gadget: f_midi: fixing a possible double-free in f_midi 2018-03-26 11:53:14 +02:00
u_os_desc.h USB: gadget: Remove redundant license text 2017-11-07 15:45:02 +01:00
usbstring.c usb/gadget: Constify usb_gadget_get_string "table" argument 2018-05-15 10:06:49 +03:00