From e3f6ac6123be6f4ba14d71af0da0e8d3d39c33ed Mon Sep 17 00:00:00 2001 From: Ishai Rabinovitz Date: Tue, 3 Oct 2006 01:15:22 -0700 Subject: [PATCH] dm: fix alloc_dev error path 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 Signed-off-by: Alasdair G Kergon Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/md/dm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/md/dm.c b/drivers/md/dm.c index 5792686936c..81717e27332 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c @@ -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); -- cgit v1.2.3