android_kernel_samsung_msm8976/drivers
Alan Stern 4d595cb24c USB: dummy-hcd: Fix erroneous synchronization change
commit 7dbd8f4cabd96db5a50513de9d83a8105a5ffc81 upstream.

A recent change to the synchronization in dummy-hcd was incorrect.
The issue was that dummy_udc_stop() contained no locking and therefore
could race with various gadget driver callbacks, and the fix was to
add locking and issue the callbacks with the private spinlock held.

UDC drivers aren't supposed to do this.  Gadget driver callback
routines are allowed to invoke functions in the UDC driver, and these
functions will generally try to acquire the private spinlock.  This
would deadlock the driver.

The correct solution is to drop the spinlock before issuing callbacks,
and avoid races by emulating the synchronize_irq() call that all real
UDC drivers must perform in their ->udc_stop() routines after
disabling interrupts.  This involves adding a flag to dummy-hcd's
private structure to keep track of whether interrupts are supposed to
be enabled, and adding a counter to keep track of ongoing callbacks so
that dummy_udc_stop() can wait for them all to finish.

A real UDC driver won't receive disconnect, reset, suspend, resume, or
setup events once it has disabled interrupts.  dummy-hcd will receive
them but won't try to issue any gadget driver callbacks, which should
be just as good.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Fixes: f16443a034c7 ("USB: gadgetfs, dummy-hcd, net2280: fix locking for callbacks")
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
[bwh: Backported to 3.16: adjust filename, context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
2019-07-27 21:45:34 +02:00
..
accessibility
acpi ACPI / APEI: Add missing synchronize_rcu() on NOTIFY_SCI removal 2019-07-27 21:44:41 +02:00
amba
android ANDROID: binder: add hwbinder,vndbinder to BINDER_DEVICES. 2018-02-06 13:12:16 +01:00
ata libata: array underflow in ata_find_dev() 2019-07-27 21:44:15 +02:00
atm
auxdisplay
base PM / Domains: Fix unsafe iteration over modified list of device links 2019-07-27 21:44:14 +02:00
battery Import T813XXS2BRC2 kernel source changes 2018-05-26 00:39:42 +02:00
battery_v2
bcma
bif
block loop: fix concurrent lo_open/lo_release 2018-08-20 11:56:48 +02:00
bluetooth Merge tag 'LA.BR.1.3.6-05410-8976.0' of https://source.codeaurora.org/quic/la/kernel/msm-3.10 into HEAD 2018-02-06 13:11:45 +01:00
bus
cdrom
char drivers: char: mem: Fix wraparound check to allow mappings up to the end 2019-07-27 21:44:47 +02:00
clk
clocksource Merge tag 'LA.BR.1.3.6-05410-8976.0' of https://source.codeaurora.org/quic/la/kernel/msm-3.10 into HEAD 2018-02-06 13:11:45 +01:00
connector
coresight
cpufreq cpufreq: s3c2416: double free on driver init error path 2019-07-27 21:44:36 +02:00
cpuidle Merge tag 'LA.BR.1.3.6-05410-8976.0' of https://source.codeaurora.org/quic/la/kernel/msm-3.10 into HEAD 2018-02-06 13:11:45 +01:00
crypto crypto: talitos - fix sha224 2019-07-27 21:45:28 +02:00
dca
debug
debug_32
devfreq
dio
dma
edac
eisa
esoc
extcon
fingerprint
firewire
firmware
gpio
gpu drm: Reject page_flip for !DRIVER_MODESET 2019-07-27 21:42:22 +02:00
hid HID: hid-lg: Fix immediate disconnection of Logitech Rumblepad 2 2019-07-27 21:44:06 +02:00
hsi
hv
hwmon
hwspinlock
i2c i2c: fix kernel memory disclosure in dev interface 2019-07-27 21:43:45 +02:00
ide
idle
iio iio: Fix error handling in iio_trigger_attach_poll_func 2019-07-27 21:41:56 +02:00
infiniband
input Input: uinput - avoid FF flush when destroying device 2019-07-27 21:45:29 +02:00
iommu iommu/amd: Finish TLB flush in amd_iommu_unmap() 2019-07-27 21:44:19 +02:00
ipack
irqchip
isdn
leds
lguest
macintosh
mailbox
md md: don't use flush_signals in userspace processes 2019-07-27 21:44:54 +02:00
media ir-core: fix gcc-7 warning on bool arithmetic 2019-07-27 21:44:38 +02:00
memory
memstick
message
mfd mfd: omap-usb-tll: Fix inverted bit use for USB TLL mode 2019-07-27 21:44:34 +02:00
misc qseecom: Fix typo in format specifier 2019-07-27 21:44:44 +02:00
mmc mmc: mxs-mmc: Fix additional cycles after transmission stop 2019-07-27 21:43:00 +02:00
motor
mtd
muic Import T813XXS2BRC2 kernel source changes 2018-05-26 00:39:42 +02:00
net ppp: Destroy the mutex when cleanup 2019-07-27 21:45:26 +02:00
nfc
ntb
nubus
of of: fdt: add missing allocation-failure check 2019-07-27 21:44:47 +02:00
oprofile
parisc
parport
pci PCI: Correct PCI_STD_RESOURCE_END usage 2019-07-27 21:44:54 +02:00
pcmcia
phy
pinctrl pinctrl: sh-pfc: Do not unconditionally support PIN_CONFIG_BIAS_DISABLE 2019-07-27 21:43:46 +02:00
platform Merge tag 'LA.BR.1.3.6-05410-8976.0' of https://source.codeaurora.org/quic/la/kernel/msm-3.10 into HEAD 2018-02-06 13:11:45 +01:00
pnp
power angler: remove 'reboot edl' interface for security 2018-05-26 00:39:32 +02:00
pps
ps3
ptp
pwm
rapidio
regulator
remoteproc
reset
rpmsg
rtc rtc: interface: ignore expired timers when enqueuing new timers 2019-07-27 21:43:55 +02:00
s390 scsi: zfcp: trace HBA FSF response by default on dismiss or timedout late response 2019-07-27 21:44:18 +02:00
sbus
scsi sd: get disk reference in sd_check_events() 2019-07-27 21:43:57 +02:00
sensorhub
sensors
sfi
sh
slimbus
sn
soc ASoC: apr: Add validity check to APR port 2018-08-20 12:08:44 +02:00
soundwire
spi
spmi
ssb
ssbi
staging Import T813XXS2BRC2 kernel source changes 2018-05-26 00:39:42 +02:00
switch
target target: Avoid mappedlun symlink creation during lun shutdown 2019-07-27 21:44:16 +02:00
tc
thermal thermal: hwmon: Properly report critical temperature in sysfs 2019-07-27 21:42:22 +02:00
tty serial: efm32: Fix parity management in 'efm32_uart_console_get_options()' 2019-07-27 21:44:33 +02:00
uio uio: fix dmem_region_start computation 2019-07-27 21:42:50 +02:00
usb USB: dummy-hcd: Fix erroneous synchronization change 2019-07-27 21:45:34 +02:00
uwb
vfio
vhost
video fbcon: Fix vc attr at deinit 2019-07-27 21:44:05 +02:00
virt
virtio
vlynq
vme
w1
watchdog
xen
zorro
Kconfig msm: gud: Remove gud driver 2017-09-08 18:49:12 +00:00
Makefile msm: gud: Remove gud driver 2017-09-08 18:49:12 +00:00