]> git.baikalelectronics.ru Git - kernel.git/commit
dm: fix use after free crash due to incorrect cleanup sequence
authorMikulas Patocka <mpatocka@redhat.com>
Fri, 10 Jul 2015 21:21:43 +0000 (17:21 -0400)
committerMike Snitzer <snitzer@redhat.com>
Mon, 13 Jul 2015 13:14:11 +0000 (09:14 -0400)
commitcdfdd2662fc7c061ab56b823ea662c911ea5a4e6
tree0f4d62164e2204cd26af74f48bd1cb43e715aef1
parent9d4eb4be8d91308713deef9427fefa2abe8639ad
dm: fix use after free crash due to incorrect cleanup sequence

Linux 4.2-rc1 Commit f9583e9efed7 ("dm: factor out a common
cleanup_mapped_device()") moved a common cleanup code to a separate
function.  Unfortunately, that commit incorrectly changed the order of
cleanup, so that it destroys the mapped_device's srcu structure
'io_barrier' before destroying its workqueue.

The function that is executed on the workqueue (dm_wq_work) uses the srcu
structure, thus it may use it after being freed.  That results in a
crash in the LVM test suite's mirror-vgreduce-removemissing.sh test.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Fixes: f9583e9efed7 ("dm: factor out a common cleanup_mapped_device()")
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
drivers/md/dm.c