[PATCH] dm: fix alloc_dev error path
authorIshai Rabinovitz <ishai@mellanox.co.il>
Tue, 3 Oct 2006 08:15:22 +0000 (01:15 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Tue, 3 Oct 2006 15:04:14 +0000 (08:04 -0700)
While reading the code I found a bug in the error path in alloc_dev in dm.c

When blk_alloc_queue fails there is no call to free_minor.

This patch fixes the problem.

Signed-off-by: Ishai Rabinovitz <ishai@mellanox.co.il>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
drivers/md/dm.c

index 5792686936c199e2fb5691a30c913d315ef33656..81717e2733273939a58a60ff397e4cad059be16d 100644 (file)
@@ -943,7 +943,7 @@ static struct mapped_device *alloc_dev(int minor)
 
        md->queue = blk_alloc_queue(GFP_KERNEL);
        if (!md->queue)
-               goto bad1;
+               goto bad1_free_minor;
 
        md->queue->queuedata = md;
        md->queue->backing_dev_info.congested_fn = dm_any_congested;
@@ -993,6 +993,7 @@ static struct mapped_device *alloc_dev(int minor)
        mempool_destroy(md->io_pool);
  bad2:
        blk_cleanup_queue(md->queue);
+ bad1_free_minor:
        free_minor(minor);
  bad1:
        module_put(THIS_MODULE);