linux-sg2042/drivers
wenlin.kang 2c2b04253b usb: gadget: printer: fix possible deadlock
The problem occurs in follow path.

printer_read()
	|
	+---setup_rx_reqs()
		|
		+---usb_ep_queue()
			|
			+---...
				|
				+---rx_complete()

Although it is clear from code, we can't get it normally.
only when we enable some spin_lock debug config option, we can find it.
eg:
BUG: spinlock lockup on CPU#0, g_printer_test_/584
 lock: bf05e158, .magic: dead4ead, .owner: g_printer_test_/584, .owner_cpu: 0
[<c0016e1c>] (unwind_backtrace+0x0/0x104) from [<c067aef8>] (dump_stack+0x20/0x24)
[<c067aef8>] (dump_stack+0x20/0x24) from [<c0680bec>] (spin_dump+0x8c/0x94)
[<c0680bec>] (spin_dump+0x8c/0x94) from [<c039071c>] (do_raw_spin_lock+0x128/0x154)
[<c039071c>] (do_raw_spin_lock+0x128/0x154) from [<c0685618>] (_raw_spin_lock_irqsave+0x64/0x70)
[<c0685618>] (_raw_spin_lock_irqsave+0x64/0x70) from [<bf05b4e8>] (rx_complete+0x54/0x10c [g_printer])
[<bf05b4e8>] (rx_complete+0x54/0x10c [g_printer]) from [<c0480478>] (musb_g_giveback+0x78/0x88)
[<c0480478>] (musb_g_giveback+0x78/0x88) from [<c048060c>] (rxstate+0xa0/0x10c)
[<c048060c>] (rxstate+0xa0/0x10c) from [<c0480d50>] (musb_ep_restart+0x44/0x70)
[<c0480d50>] (musb_ep_restart+0x44/0x70) from [<c0480fe4>] (musb_gadget_queue+0xe8/0xf8)
[<c0480fe4>] (musb_gadget_queue+0xe8/0xf8) from [<bf05b2b0>] (setup_rx_reqs+0xa4/0x178 [g_printer])
[<bf05b2b0>] (setup_rx_reqs+0xa4/0x178 [g_printer]) from [<bf05bb58>] (printer_read+0x9c/0x3f4 [g_printer])
[<bf05bb58>] (printer_read+0x9c/0x3f4 [g_printer]) from [<c01387f0>] (vfs_read+0xb4/0x144)
[<c01387f0>] (vfs_read+0xb4/0x144) from [<c01388d0>] (sys_read+0x50/0x124)
[<c01388d0>] (sys_read+0x50/0x124) from [<c000e900>] (ret_fast_syscall+0x0/0x3c)

The root cause is that we use the same lock two time in a path, so to avoid
the deadlock, we need to unlock in setup_rx_reqs(), and only unlock.

Signed-off-by: wenlin.kang <wenlin.kang@windriver.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-02-18 10:52:54 -06:00
..
accessibility
acpi Merge branches 'acpi-processor', 'acpi-hotplug', 'acpi-init', 'acpi-pm' and 'acpica' 2014-01-29 11:47:18 +01:00
amba
ata ACPI and power management updates for 3.14-rc1 2014-01-24 15:51:02 -08:00
atm
auxdisplay
base regmap: Updates for v3.14 2014-01-25 13:18:00 -08:00
bcma Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus 2014-01-30 17:20:32 -08:00
block Bug-fixes: 2014-01-31 08:38:18 -08:00
bluetooth
bus drivers: bus: fix CCI driver kcalloc call parameters swap 2014-01-31 15:15:13 -08:00
cdrom Merge branch 'for-3.14/drivers' of git://git.kernel.dk/linux-block 2014-01-30 11:40:10 -08:00
char ipmi: Add missing rv in ipmi_parisc_probe() 2014-01-30 10:02:54 -08:00
clk The second half of the clock framework pull requeust for 3.14 is 2014-01-28 18:44:53 -08:00
clocksource clocksource: kona: Add basic use of external clock 2014-01-31 21:04:01 -08:00
connector
cpufreq ACPI and power management fixes and cleanups for 3.14-rc1 2014-01-31 09:23:52 -08:00
cpuidle powerpc/powernv/cpuidle: Back-end cpuidle driver for powernv platform. 2014-01-29 17:02:24 +11:00
crypto ARM: driver updates for 3.14 2014-01-23 18:49:36 -08:00
dca
devfreq Merge branches 'pm-cpufreq' and 'pm-devfreq' 2014-01-29 11:48:23 +01:00
dio
dma Merge branch 'for-linus' of git://git.infradead.org/users/vkoul/slave-dma 2014-01-29 20:27:23 -08:00
edac Merge branch 'x86-ras-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2014-01-20 12:10:27 -08:00
eisa Revert "EISA: Initialize device before its resources" 2014-01-17 14:57:29 -07:00
extcon extcon: gpio: Add power resume support 2014-01-09 09:53:30 +09:00
firewire firewire: Enable remote DMA above 4 GB 2014-01-20 01:11:13 +01:00
firmware firmware/google: drop 'select EFI' to avoid recursive dependency 2014-01-27 21:02:40 -08:00
fmc
gpio ARM: driver updates for 3.14 2014-01-23 18:49:36 -08:00
gpu Merge branch 'drm-next' of git://people.freedesktop.org/~airlied/linux 2014-01-29 20:49:12 -08:00
hid usbhid/quirks: Ignore Riso Kagaku Webmail Notifier 2014-02-15 12:26:48 -08:00
hsi
hv hyperv: Add support for physically discontinuous receive buffer 2014-01-27 16:40:45 -08:00
hwmon hwmon: Fix SENSORS_TMP102 dependencies to eliminate build errors 2014-02-02 17:59:07 +01:00
hwspinlock
i2c Merge branch 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux 2014-01-29 19:56:20 -08:00
ide drivers: ide: Include appropriate header file in ide-pio-blacklist.c 2014-01-28 23:35:09 -08:00
idle ACPI and power management updates for 3.14-rc1 2014-01-24 15:51:02 -08:00
iio Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2014-01-22 21:21:55 -08:00
infiniband Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending 2014-01-31 15:31:23 -08:00
input Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input 2014-01-24 17:17:30 -08:00
iommu IOMMU Updates for Linux v3.14 2014-01-29 20:00:13 -08:00
ipack
irqchip mvebu fixes for v3.13 (incremental #2) 2014-01-31 14:59:28 -08:00
isdn Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2014-01-25 11:17:34 -08:00
leds Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/cooloney/linux-leds 2014-01-28 18:53:01 -08:00
lguest
macintosh Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc 2014-01-27 21:11:26 -08:00
mailbox drivers/mailbox/omap: make mbox->irq signed for error handling 2014-01-23 16:36:53 -08:00
md Merge branch 'for-3.14/drivers' of git://git.kernel.dk/linux-block 2014-01-30 11:40:10 -08:00
media Merge branch 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media 2014-01-31 09:31:14 -08:00
memory
memstick drivers/memstick/host/rtsx_pci_ms.c: fix ms card data transfer bug 2014-01-23 16:37:04 -08:00
message Merge branch 'for-3.14/core' of git://git.kernel.dk/linux-block 2014-01-30 11:19:05 -08:00
mfd regulator: Updates for v3.14 2014-01-25 13:19:10 -08:00
misc Merge branch 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging 2014-01-29 18:56:27 -08:00
mmc MMC highlights for 3.14: 2014-01-26 11:00:41 -08:00
mtd * Improve the NOR erasure quirk - now it tries to do as little writes as 2014-01-30 20:04:09 -08:00
net Merge branch 'akpm' (patches from Andrew Morton) 2014-01-30 18:44:44 -08:00
nfc NFC: nfcmrvl: Fix possible memory leak issue 2014-01-09 01:27:20 +01:00
ntb
nubus
of Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2014-01-25 11:17:34 -08:00
oprofile
parisc
parport TTY/Serial driver patches for 3.14-rc1 2014-01-20 16:05:23 -08:00
pci Revert "PCI: Remove from bus_list and release resources in pci_release_dev()" 2014-02-01 10:24:31 -08:00
pcmcia PCI changes for the v3.14 merge window: 2014-01-22 16:39:28 -08:00
phy phy-core: Don't allow building phy-core as a module 2014-02-15 12:28:39 -08:00
pinctrl ARM: SoC DT updates for 3.14 2014-01-23 18:45:38 -08:00
platform platform/chrome: Cleanups and improvements 2014-01-29 20:06:01 -08:00
pnp Merge branch 'pnp' 2014-01-12 23:48:18 +01:00
power Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2014-01-25 11:17:34 -08:00
powercap
pps
ps3
ptp ptp_pch: Add dependency on HAS_IOMEM 2014-01-15 14:51:22 -08:00
pwm pwm: Changes for v3.14-rc1 2014-01-27 08:15:51 -08:00
rapidio
regulator regulator: Updates for v3.14 2014-01-25 13:19:10 -08:00
remoteproc
reset
rpmsg
rtc Merge branch 'akpm' (incoming from Andrew) 2014-01-23 19:11:50 -08:00
s390 Second batch of KVM updates. Some minor x86 fixes, 2014-01-31 08:37:32 -08:00
sbus sparc: delete non-required instances of include <linux/init.h> 2014-01-28 23:38:23 -08:00
scsi Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending 2014-01-31 15:31:23 -08:00
sfi
sh
sn
spi Merge remote-tracking branch 'agust/next' into next 2014-01-29 16:53:55 +11:00
ssb Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus 2014-01-30 17:20:32 -08:00
staging Staging wireless driver for 3.14-rc1 2014-02-01 10:29:59 -08:00
target Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending 2014-01-31 15:31:23 -08:00
tc
thermal Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux 2014-01-24 17:13:49 -08:00
tty Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus 2014-01-30 17:20:32 -08:00
uio
usb usb: gadget: printer: fix possible deadlock 2014-02-18 10:52:54 -06:00
uwb
vfio Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc 2014-01-27 21:11:26 -08:00
vhost Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending 2014-01-31 15:31:23 -08:00
video parisc/sti_console: prefer Linux fonts over built-in ROM fonts 2014-02-02 20:56:47 +01:00
virt
virtio A few simple fixes. Quiet cycle. 2014-01-22 22:24:35 -08:00
vlynq drivers/vlynq/vlynq.c: fix another resource size off by 1 error 2014-01-23 16:36:55 -08:00
vme
w1 drivers/w1/masters/w1-gpio.c: add strong pullup emulation 2014-01-23 16:37:04 -08:00
watchdog watchdog: w83627hf_wdt: Reset watchdog trigger during initialization 2014-01-28 21:35:40 +01:00
xen Bug-fixes: 2014-01-31 08:38:18 -08:00
zorro
Kconfig
Makefile