Skip to content

Commit

Permalink
[PATCH] dm: free minor after unlink gendisk
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jun'ichi Nomura authored and Linus Torvalds committed Feb 24, 2006
1 parent d9dde59 commit 63d94e4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/md/dm.c
Original file line number Diff line number Diff line change
Expand Up @@ -849,14 +849,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->suspended_bdev) {
thaw_bdev(md->suspended_bdev, NULL);
bdput(md->suspended_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);
Expand Down

0 comments on commit 63d94e4

Please sign in to comment.