summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJun'ichi Nomura <j-nomura@ce.jp.nec.com>2006-02-24 13:04:25 -0800
committerChris Wright <chrisw@sous-sol.org>2006-03-01 14:36:36 -0800
commite5a78bb9935a635ebcb71c10899c53bfc99f8c7f (patch)
treeb66a200309cdc07afc815a5aba04204ea0589ffa
parent2687a132e9d6e5e9249fc2b961ab37cf185dd3c8 (diff)
[PATCH] dm: free minor after unlink gendisk
Minor number should be freed after del_gendisk(). Otherwise, there could be a window where 2 registered gendisk has same minor number. Signed-off-by: Jun'ichi Nomura <j-nomura@ce.jp.nec.com> Acked-by: Alasdair G Kergon <agk@redhat.com> Cc: <stable@kernel.org> Signed-off-by: Andrew Morton <akpm@osdl.org> [chrisw: backport to 2.6.15] Signed-off-by: Chris Wright <chrisw@sous-sol.org>
-rw-r--r--drivers/md/dm.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index e0b63d7f5704..3b7701a03861 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -812,14 +812,16 @@ static struct mapped_device *alloc_dev(unsigned int minor, int persistent)
static void free_dev(struct mapped_device *md)
{
+ unsigned int minor = md->disk->first_minor;
+
if (md->frozen_bdev) {
thaw_bdev(md->frozen_bdev, NULL);
bdput(md->frozen_bdev);
}
- free_minor(md->disk->first_minor);
mempool_destroy(md->tio_pool);
mempool_destroy(md->io_pool);
del_gendisk(md->disk);
+ free_minor(minor);
put_disk(md->disk);
blk_put_queue(md->queue);
kfree(md);