aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorJun'ichi Nomura <j-nomura@ce.jp.nec.com>2006-02-24 16:04:25 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-02-24 17:31:39 -0500
commit63d94e482df769f31e8b1097f06c3a3fba7bced4 (patch)
tree0461197daa1d7df50087b4dfa2b692dfcd81d745 /drivers
parentd9dde59ba03095e526640988c0fedd75e93bc8b7 (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> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers')
-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 dad9e403d59d..745ca1f67b14 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -849,14 +849,16 @@ static struct mapped_device *alloc_dev(unsigned int minor, int persistent)
849 849
850static void free_dev(struct mapped_device *md) 850static void free_dev(struct mapped_device *md)
851{ 851{
852 unsigned int minor = md->disk->first_minor;
853
852 if (md->suspended_bdev) { 854 if (md->suspended_bdev) {
853 thaw_bdev(md->suspended_bdev, NULL); 855 thaw_bdev(md->suspended_bdev, NULL);
854 bdput(md->suspended_bdev); 856 bdput(md->suspended_bdev);
855 } 857 }
856 free_minor(md->disk->first_minor);
857 mempool_destroy(md->tio_pool); 858 mempool_destroy(md->tio_pool);
858 mempool_destroy(md->io_pool); 859 mempool_destroy(md->io_pool);
859 del_gendisk(md->disk); 860 del_gendisk(md->disk);
861 free_minor(minor);
860 put_disk(md->disk); 862 put_disk(md->disk);
861 blk_put_queue(md->queue); 863 blk_put_queue(md->queue);
862 kfree(md); 864 kfree(md);