linux-uconsole/drivers
Mikulas Patocka f23fb645ee dm: free dm_io before bio_endio not after
commit a97f925a32 upstream.

Free the dm_io structure before calling bio_endio() instead of after it,
to ensure that the io_pool containing it is not referenced after it is
freed.

This partially fixes a problem described here
  https://www.redhat.com/archives/dm-devel/2010-February/msg00109.html

thread 1:
bio_endio(bio, io_error);
/* scheduling happens */
					thread 2:
					close the device
					remove the device
thread 1:
free_io(md, io);

Thread 2, when removing the device, sees non-empty md->io_pool (because the
io hasn't been freed by thread 1 yet) and may crash with BUG in mempool_free.
Thread 1 may also crash, when freeing into a nonexisting mempool.

To fix this we must make sure that bio_endio() is the last call and
the md structure is not accessed afterwards.

There is another bio_endio in process_barrier, but it is called from the thread
and the thread is destroyed prior to freeing the mempools, so this call is
not affected by the bug.

A similar bug exists with module unloads - the module may be unloaded
immediately after bio_endio - but that is more difficult to fix.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-03-15 08:50:14 -07:00
..
accessibility
acpi ACPI: Be in TS_POLLING state during mwait based C-state entry 2010-03-15 08:49:36 -07:00
amba
ata pata_hpt3x2n: always stretch UltraDMA timing 2010-03-15 08:49:58 -07:00
atm
auxdisplay
base Driver-Core: devtmpfs - reset inode permissions before unlinking 2010-03-15 08:49:53 -07:00
block cciss: Make cciss_seq_show handle holes in the h->drv[] array 2010-02-23 07:37:49 -08:00
bluetooth Bluetooth: Prevent ill-timed autosuspend in USB driver 2010-01-06 15:03:43 -08:00
cdrom
char tty: Fix the ldisc hangup race 2010-03-15 08:49:54 -07:00
clocksource clocksource: Fix up a registration/IRQ race in the sh drivers. 2010-03-15 08:49:44 -07:00
connector connector: Delete buggy notification code. 2010-02-09 04:50:59 -08:00
cpufreq
cpuidle drivers/cpuidle/governors/menu.c: fix undefined reference to `__udivdi3' 2010-01-18 10:19:31 -08:00
crypto crypto: padlock-sha - Add import/export support 2010-02-23 07:37:54 -08:00
dca
dio
dma ioat: fix infinite timeout checking in ioat2_quiesce 2010-02-23 07:37:49 -08:00
edac amd64_edac: Do not falsely trigger kerneloops 2010-02-23 07:37:52 -08:00
eisa
firewire firewire: core: add_descriptor size check 2010-02-09 04:50:52 -08:00
firmware DMI: allow omitting ident strings in DMI tables 2010-01-28 15:01:52 -08:00
gpio gpiolib: Actually set output state in wm831x_gpio_direction_output() 2010-03-15 08:49:57 -07:00
gpu drm/ttm: handle OOM in ttm_tt_swapout 2010-03-15 08:50:12 -07:00
hid HID: usbhid: introduce timeout for stuck ctrl/out URBs 2010-03-15 08:49:37 -07:00
hwmon hwmon: (tmp421) Restore missing inputs 2010-03-15 08:49:57 -07:00
i2c i2c-tiny-usb: Fix on big-endian systems 2010-02-23 07:37:48 -08:00
ide
idle
ieee1394
ieee802154
infiniband Fix failure exit in ipathfs 2010-02-09 04:50:48 -08:00
input Input: winbond-cir - remove dmesg spam 2010-02-09 04:50:51 -08:00
isdn
leds
lguest lguest: fix bug in setting guest GDT entry 2010-01-06 15:05:19 -08:00
macintosh macintosh/therm_adt746x: Fix sysfs attributes lifetime 2010-03-15 08:49:46 -07:00
mca
md dm: free dm_io before bio_endio not after 2010-03-15 08:50:14 -07:00
media V4L/DVB (13148): uvcvideo: Handle V4L2_CTRL_TYPE_BUTTON control type in VIDIOC_QUERYCTRL 2010-03-15 08:49:46 -07:00
memstick
message SCSI: mptfusion : mptscsih_abort return value should be SUCCESS instead of value 0. 2010-02-23 07:37:55 -08:00
mfd mfd: WM835x GPIO direction register is not locked 2010-01-22 15:18:18 -08:00
misc SCSI: enclosure: fix oops while iterating enclosure_status array 2010-01-25 10:49:37 -08:00
mmc s3cmci: s3cmci_card_present: Use no_detect to decide whether there is a card detect pin 2010-03-15 08:50:14 -07:00
mtd UBI: fix volume creation input checking 2010-02-09 04:50:45 -08:00
net b43/b43legacy: Wake queues in wireless_core_start 2010-03-15 08:50:00 -07:00
nubus
of
oprofile
parisc
parport
pci PCI hotplug: check ioremap() return value in ibmphp_ebda.c 2010-03-15 08:49:35 -07:00
pcmcia PCI/cardbus: Add a fixup hook and fix powerpc 2010-01-22 15:18:26 -08:00
platform thinkpad-acpi: fix bluetooth/wwan resume 2010-03-15 08:50:04 -07:00
pnp
power
pps
ps3
rapidio
regulator regulator: Fix display of null constraints for regulators 2010-02-23 07:37:49 -08:00
rtc rtc-coh901331: fix braces in resume code 2010-03-15 08:50:14 -07:00
s390 dasd: remove strings from s390dbf 2010-02-23 07:37:54 -08:00
sbus
scsi SCSI: qla1280: Drop host_lock while requesting firmware 2010-03-15 08:49:44 -07:00
serial serial: imx: fix NULL dereference Oops when pdata == NULL 2010-03-15 08:49:54 -07:00
sfi
sh
sn
spi
ssb
staging Staging: mimio: remove the mimio driver 2010-03-15 08:49:46 -07:00
tc
telephony
thermal
uio
usb USB: unusual_devs: Add support for multiple Option 3G sticks 2010-03-15 08:50:12 -07:00
uwb
video sunxvr500: Additional PCI id for sunxvr500 driver 2010-03-15 08:50:02 -07:00
virtio
vlynq
w1
watchdog bfin: fix max timeout calculation 2010-03-15 08:49:32 -07:00
xen xen: fix hang on suspend. 2010-01-18 10:19:44 -08:00
zorro
Kconfig
Makefile