linux/drivers
Marc Dionne 2b94e8960c dm thin: fix crash by initializing thin device's refcount and completion earlier
Commit 80e96c5484 ("dm thin: do not allow thin device activation
while pool is suspended") delayed the initialization of a new thin
device's refcount and completion until after this new thin was added
to the pool's active_thins list and the pool lock is released.  This
opens a race with a worker thread that walks the list and calls
thin_get/put, noticing that the refcount goes to 0 and calling
complete, freezing up the system and giving the oops below:

 kernel: BUG: unable to handle kernel NULL pointer dereference at           (null)
 kernel: IP: [<ffffffff810d360b>] __wake_up_common+0x2b/0x90

 kernel: Call Trace:
 kernel: [<ffffffff810d3683>] __wake_up_locked+0x13/0x20
 kernel: [<ffffffff810d3dc7>] complete+0x37/0x50
 kernel: [<ffffffffa0595c50>] thin_put+0x20/0x30 [dm_thin_pool]
 kernel: [<ffffffffa059aab7>] do_worker+0x667/0x870 [dm_thin_pool]
 kernel: [<ffffffff816a8a4c>] ? __schedule+0x3ac/0x9a0
 kernel: [<ffffffff810b1aef>] process_one_work+0x14f/0x400
 kernel: [<ffffffff810b206b>] worker_thread+0x6b/0x490
 kernel: [<ffffffff810b2000>] ? rescuer_thread+0x260/0x260
 kernel: [<ffffffff810b6a7b>] kthread+0xdb/0x100
 kernel: [<ffffffff810b69a0>] ? kthread_create_on_node+0x170/0x170
 kernel: [<ffffffff816ad7ec>] ret_from_fork+0x7c/0xb0
 kernel: [<ffffffff810b69a0>] ? kthread_create_on_node+0x170/0x170

Set the thin device's initial refcount and initialize the completion
before adding it to the pool's active_thins list in thin_ctr().

Signed-off-by: Marc Dionne <marc.dionne@your-file-system.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
2014-12-17 12:06:25 -05:00
..
accessibility
acpi Driver core patches for 3.19-rc1 2014-12-14 16:10:09 -08:00
amba Char/Misc driver patches for 3.19-rc1 2014-12-14 16:43:47 -08:00
ata Driver core patches for 3.19-rc1 2014-12-14 16:10:09 -08:00
atm Driver core patches for 3.19-rc1 2014-12-14 16:10:09 -08:00
auxdisplay
base Driver core patches for 3.19-rc1 2014-12-14 16:10:09 -08:00
bcma Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus 2014-12-11 17:56:37 -08:00
block Driver core patches for 3.19-rc1 2014-12-14 16:10:09 -08:00
bluetooth Driver core patches for 3.19-rc1 2014-12-14 16:10:09 -08:00
bus Driver core patches for 3.19-rc1 2014-12-14 16:10:09 -08:00
cdrom
char Merge branch 'drm-next' of git://people.freedesktop.org/~airlied/linux 2014-12-15 15:52:01 -08:00
clk Driver core patches for 3.19-rc1 2014-12-14 16:10:09 -08:00
clocksource Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus 2014-12-11 17:56:37 -08:00
connector
coresight
cpufreq Driver core patches for 3.19-rc1 2014-12-14 16:10:09 -08:00
cpuidle Driver core patches for 3.19-rc1 2014-12-14 16:10:09 -08:00
crypto Driver core patches for 3.19-rc1 2014-12-14 16:10:09 -08:00
dca
devfreq
dio
dma Driver core patches for 3.19-rc1 2014-12-14 16:10:09 -08:00
dma-buf
edac Driver core patches for 3.19-rc1 2014-12-14 16:10:09 -08:00
eisa
extcon Char/Misc driver patches for 3.19-rc1 2014-12-14 16:43:47 -08:00
firewire
firmware Driver core patches for 3.19-rc1 2014-12-14 16:10:09 -08:00
fmc
gpio Driver core patches for 3.19-rc1 2014-12-14 16:10:09 -08:00
gpu Merge branch 'drm-next' of git://people.freedesktop.org/~airlied/linux 2014-12-15 15:52:01 -08:00
hid Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid 2014-12-12 10:26:47 -08:00
hsi Driver core patches for 3.19-rc1 2014-12-14 16:10:09 -08:00
hv Char/Misc driver patches for 3.19-rc1 2014-12-14 16:43:47 -08:00
hwmon Driver core patches for 3.19-rc1 2014-12-14 16:10:09 -08:00
hwspinlock
i2c Driver core patches for 3.19-rc1 2014-12-14 16:10:09 -08:00
ide Driver core patches for 3.19-rc1 2014-12-14 16:10:09 -08:00
idle
iio Driver core patches for 3.19-rc1 2014-12-14 16:10:09 -08:00
infiniband Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2014-12-11 14:27:06 -08:00
input Driver core patches for 3.19-rc1 2014-12-14 16:10:09 -08:00
iommu Merge branch 'drm-next' of git://people.freedesktop.org/~airlied/linux 2014-12-15 15:52:01 -08:00
ipack
irqchip Driver core patches for 3.19-rc1 2014-12-14 16:10:09 -08:00
isdn Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2014-12-12 10:08:06 -08:00
leds Driver core patches for 3.19-rc1 2014-12-14 16:10:09 -08:00
lguest virtio: allow finalize_features to fail 2014-12-09 16:32:32 +02:00
macintosh
mailbox Driver core patches for 3.19-rc1 2014-12-14 16:10:09 -08:00
mcb
md dm thin: fix crash by initializing thin device's refcount and completion earlier 2014-12-17 12:06:25 -05:00
media Driver core patches for 3.19-rc1 2014-12-14 16:10:09 -08:00
memory Driver core patches for 3.19-rc1 2014-12-14 16:10:09 -08:00
memstick
message
mfd Driver core patches for 3.19-rc1 2014-12-14 16:10:09 -08:00
misc Char/Misc driver patches for 3.19-rc1 2014-12-14 16:43:47 -08:00
mmc Driver core patches for 3.19-rc1 2014-12-14 16:10:09 -08:00
mtd Driver core patches for 3.19-rc1 2014-12-14 16:10:09 -08:00
net Driver core patches for 3.19-rc1 2014-12-14 16:10:09 -08:00
nfc Driver core patches for 3.19-rc1 2014-12-14 16:10:09 -08:00
ntb
nubus
of Merge branch 'i2c/for-3.19' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux 2014-12-14 12:54:40 -08:00
oprofile
parisc
parport Char/Misc driver patches for 3.19-rc1 2014-12-14 16:43:47 -08:00
pci Driver core patches for 3.19-rc1 2014-12-14 16:10:09 -08:00
pcmcia Char/Misc driver patches for 3.19-rc1 2014-12-14 16:43:47 -08:00
phy
pinctrl Driver core patches for 3.19-rc1 2014-12-14 16:10:09 -08:00
platform Driver core patches for 3.19-rc1 2014-12-14 16:10:09 -08:00
pnp
power Driver core patches for 3.19-rc1 2014-12-14 16:10:09 -08:00
powercap
pps
ps3
ptp
pwm
rapidio
ras
regulator Driver core patches for 3.19-rc1 2014-12-14 16:10:09 -08:00
remoteproc Driver core patches for 3.19-rc1 2014-12-14 16:10:09 -08:00
reset Driver core patches for 3.19-rc1 2014-12-14 16:10:09 -08:00
rpmsg
rtc Driver core patches for 3.19-rc1 2014-12-14 16:10:09 -08:00
s390 Driver core patches for 3.19-rc1 2014-12-14 16:10:09 -08:00
sbus
scsi Driver core patches for 3.19-rc1 2014-12-14 16:10:09 -08:00
sfi
sh
sn
soc Merge branch 'drm-next' of git://people.freedesktop.org/~airlied/linux 2014-12-15 15:52:01 -08:00
spi Driver core patches for 3.19-rc1 2014-12-14 16:10:09 -08:00
spmi
ssb Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus 2014-12-11 17:56:37 -08:00
staging Merge branch 'drm-next' of git://people.freedesktop.org/~airlied/linux 2014-12-15 15:52:01 -08:00
target Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2014-12-12 10:08:06 -08:00
tc
thermal Driver core patches for 3.19-rc1 2014-12-14 16:10:09 -08:00
thunderbolt
tty Driver core patches for 3.19-rc1 2014-12-14 16:10:09 -08:00
uio Char/Misc driver patches for 3.19-rc1 2014-12-14 16:43:47 -08:00
usb Driver core patches for 3.19-rc1 2014-12-14 16:10:09 -08:00
uwb
vfio
vhost Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2014-12-11 14:27:06 -08:00
video Driver core patches for 3.19-rc1 2014-12-14 16:10:09 -08:00
virt
virtio Driver core patches for 3.19-rc1 2014-12-14 16:10:09 -08:00
vlynq
vme
w1 Char/Misc driver patches for 3.19-rc1 2014-12-14 16:43:47 -08:00
watchdog Driver core patches for 3.19-rc1 2014-12-14 16:10:09 -08:00
xen xen: features and fixes for 3.19-rc0 2014-12-11 18:15:33 -08:00
zorro
Kconfig
Makefile