android_kernel_motorola_sm6225/drivers
Michael S. Tsirkin 0ad8b480d6 vhost: fix ref cnt checking deadlock
vhost checked the counter within the refcnt before decrementing.  It
really wanted to know that it is the one that has the last reference, as
a way to batch freeing resources a bit more efficiently.

Note: we only let refcount go to 0 on device release.

This works well but we now access the ref counter twice so there's a
race: all users might see a high count and decide to defer freeing
resources.
In the end no one initiates freeing resources until the last reference
is gone (which is on VM shotdown so might happen after a looooong time).

Let's do what we probably should have done straight away:
switch from kref to plain atomic, documenting the
semantics, return the refcount value atomically after decrement,
then use that to avoid the deadlock.

Reported-by: Qin Chuanyu <qinchuanyu@huawei.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2014-02-13 18:47:30 -05:00
..
accessibility
acpi Merge branches 'acpi-cleanup' and 'acpi-video' 2014-02-06 23:08:54 +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-02-05 16:01:11 -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 fix a kmap leak in virtio_console 2014-02-09 15:21:16 -05: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 intel_pstate: Take core C0 time into account for core busy calculation 2014-02-04 21:41:15 +01: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 drivers/edac/edac_mc_sysfs.c: poll timeout cannot be zero 2014-02-10 16:01:41 -08:00
eisa Revert "EISA: Initialize device before its resources" 2014-01-17 14:57:29 -07:00
extcon
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 drm/radeon: allow geom rings to be setup on r600/r700 (v2) 2014-02-06 12:13:52 +10:00
hid 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
hsi
hv hyperv: Add support for physically discontinuous receive buffer 2014-01-27 16:40:45 -08:00
hwmon hwmon: (da9055) Remove use of regmap_irq_get_virq() 2014-02-06 17:22:33 -08: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 Merge branch 'irq-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2014-02-05 16:02:53 -08:00
isdn isdn/hisax: hex vs decimal typo in prfeatureind() 2014-02-06 21:18:06 -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 drivers/md/bcache/extents.c: use %zi to format size_t 2014-02-10 16:01:40 -08:00
media [media] adv7842: Composite free-run platfrom-data fix 2014-02-04 06:46:10 -02: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 drivers/message/i2o/i2o_config.c: fix deadlock in compat_ioctl(I2OGETIOPS) 2014-02-10 16:01:40 -08:00
mfd regulator: Updates for v3.14 2014-01-25 13:19:10 -08:00
misc drivers/misc/sgi-gru/grukdump.c: unlocking should be conditional in gru_dump_context() 2014-02-10 16:01:39 -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 USB2NET: Fix Default to 'y' for SR9800 Device Driver, setting to 'n' 2014-02-13 18:42:01 -05:00
nfc
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 ACPI / hotplug / PCI: Fix bridge removal race vs dock events 2014-02-03 22:30:15 +01:00
pcmcia PCI changes for the v3.14 merge window: 2014-01-22 16:39:28 -08:00
phy Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2014-01-25 11:17:34 -08:00
pinctrl pinctrl: tegra: return correct error type 2014-02-06 14:21:19 +01:00
platform platform/chrome: Cleanups and improvements 2014-01-29 20:06:01 -08:00
pnp
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 Merge remote-tracking branches 'regulator/fix/ab3100' and 'regulator/fix/s2mps11' into regulator-linus 2014-02-04 12:58:19 +00:00
remoteproc
reset
rpmsg
rtc Merge branch 'akpm' (incoming from Andrew) 2014-01-23 19:11:50 -08:00
s390 Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux 2014-02-11 12:23:50 -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 [media] go7007-loader: fix usb_dev leak 2014-02-04 06:28:00 -02: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 Merge remote-tracking branch 'agust/next' into next 2014-01-29 16:53:55 +11: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 vhost: fix ref cnt checking deadlock 2014-02-13 18:47:30 -05: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: dw_wdt: Add dependency on HAS_IOMEM 2014-02-08 09:47:11 +01:00
xen Bug-fixes: 2014-02-05 16:01:11 -08:00
zorro
Kconfig
Makefile