linux/drivers/md
Mikulas Patocka a97f925a32 dm: free dm_io before bio_endio not after
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>
Cc: stable@kernel.org
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
2010-03-06 02:32:29 +00:00
..
raid6test
.gitignore
bitmap.c md/bitmap: update dirty flag when bitmap bits are explicitly set. 2009-12-14 12:51:41 +11:00
bitmap.h md: Support write-intent bitmaps with externally managed metadata. 2009-12-14 12:51:41 +11:00
dm-bio-record.h
dm-crypt.c dm table: remove unused dm_get_device range parameters 2010-03-06 02:32:27 +00:00
dm-delay.c dm table: remove unused dm_get_device range parameters 2010-03-06 02:32:27 +00:00
dm-exception-store.c dm snapshot: move cow ref from exception store to snap core 2009-12-10 23:52:12 +00:00
dm-exception-store.h dm snapshot: add merging 2009-12-10 23:52:32 +00:00
dm-io.c dm io: handle empty barriers 2009-12-10 23:52:22 +00:00
dm-ioctl.c dm ioctl: only issue uevent on resume if state changed 2010-03-06 02:32:24 +00:00
dm-kcopyd.c dm kcopyd: accept zero size jobs 2009-12-10 23:52:13 +00:00
dm-linear.c dm table: remove unused dm_get_device range parameters 2010-03-06 02:32:27 +00:00
dm-log-userspace-base.c
dm-log-userspace-transfer.c dm log: userspace fix overhead_size calcuations 2010-02-16 18:42:53 +00:00
dm-log-userspace-transfer.h
dm-log.c dm table: remove unused dm_get_device range parameters 2010-03-06 02:32:27 +00:00
dm-mpath.c dm table: remove unused dm_get_device range parameters 2010-03-06 02:32:27 +00:00
dm-mpath.h
dm-path-selector.c
dm-path-selector.h
dm-queue-length.c
dm-raid1.c dm table: remove unused dm_get_device range parameters 2010-03-06 02:32:27 +00:00
dm-region-hash.c dm raid1: fix null pointer dereference in suspend 2010-02-16 18:42:58 +00:00
dm-round-robin.c
dm-service-time.c
dm-snap-persistent.c dm snapshot: persistent annotate work_queue as on stack 2010-02-16 18:42:51 +00:00
dm-snap-transient.c dm snapshot: move cow ref from exception store to snap core 2009-12-10 23:52:12 +00:00
dm-snap.c dm table: remove unused dm_get_device range parameters 2010-03-06 02:32:27 +00:00
dm-stripe.c dm table: remove unused dm_get_device range parameters 2010-03-06 02:32:27 +00:00
dm-sysfs.c dm: sysfs revert add empty release function to avoid debug warning 2010-02-16 18:43:04 +00:00
dm-table.c dm table: remove unused dm_get_device range parameters 2010-03-06 02:32:27 +00:00
dm-target.c
dm-uevent.c dm table: remove dm_get from dm_table_get_md 2010-03-06 02:29:52 +00:00
dm-uevent.h
dm-zero.c
dm.c dm: free dm_io before bio_endio not after 2010-03-06 02:32:29 +00:00
dm.h dm: rename dm_suspended to dm_suspended_md 2009-12-10 23:52:26 +00:00
faulty.c md: add MODULE_DESCRIPTION for all md related modules. 2009-12-14 12:51:41 +11:00
Kconfig md: revise Kconfig help for MD_MULTIPATH 2009-12-14 12:51:41 +11:00
linear.c block: Rename blk_queue_max_sectors to blk_queue_max_hw_sectors 2010-02-26 13:58:08 +01:00
linear.h
Makefile
md.c md: fix some lockdep issues between md and sysfs. 2010-02-10 11:26:09 +11:00
md.h raid: improve MD/raid10 handling of correctable read errors. 2009-12-14 12:51:41 +11:00
mktables.c
multipath.c block: Rename blk_queue_max_sectors to blk_queue_max_hw_sectors 2010-02-26 13:58:08 +01:00
multipath.h
raid0.c block: Rename blk_queue_max_sectors to blk_queue_max_hw_sectors 2010-02-26 13:58:08 +01:00
raid0.h
raid1.c block: Rename blk_queue_max_sectors to blk_queue_max_hw_sectors 2010-02-26 13:58:08 +01:00
raid1.h md/raid1: add takeover support for raid5->raid1 2009-12-14 12:51:41 +11:00
raid5.c Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/percpu 2010-03-03 07:34:18 -08:00
raid5.h percpu: add __percpu sparse annotations to what's left 2010-02-17 11:17:38 +09:00
raid6algos.c md: add MODULE_DESCRIPTION for all md related modules. 2009-12-14 12:51:41 +11:00
raid6altivec.uc
raid6int.uc
raid6mmx.c
raid6recov.c
raid6sse1.c
raid6sse2.c
raid6x86.h
raid10.c block: Rename blk_queue_max_sectors to blk_queue_max_hw_sectors 2010-02-26 13:58:08 +01:00
raid10.h
unroll.awk