Commit e3f6ac61 authored by Ishai Rabinovitz's avatar Ishai Rabinovitz Committed by Linus Torvalds

[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: default avatarIshai Rabinovitz <ishai@mellanox.co.il>
Signed-off-by: default avatarAlasdair G Kergon <agk@redhat.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent e90dae1f
...@@ -943,7 +943,7 @@ static struct mapped_device *alloc_dev(int minor) ...@@ -943,7 +943,7 @@ static struct mapped_device *alloc_dev(int minor)
md->queue = blk_alloc_queue(GFP_KERNEL); md->queue = blk_alloc_queue(GFP_KERNEL);
if (!md->queue) if (!md->queue)
goto bad1; goto bad1_free_minor;
md->queue->queuedata = md; md->queue->queuedata = md;
md->queue->backing_dev_info.congested_fn = dm_any_congested; md->queue->backing_dev_info.congested_fn = dm_any_congested;
...@@ -993,6 +993,7 @@ static struct mapped_device *alloc_dev(int minor) ...@@ -993,6 +993,7 @@ static struct mapped_device *alloc_dev(int minor)
mempool_destroy(md->io_pool); mempool_destroy(md->io_pool);
bad2: bad2:
blk_cleanup_queue(md->queue); blk_cleanup_queue(md->queue);
bad1_free_minor:
free_minor(minor); free_minor(minor);
bad1: bad1:
module_put(THIS_MODULE); module_put(THIS_MODULE);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment