Skip to content

Commit

Permalink
[PATCH] dm: fix alloc_dev error path
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Ishai Rabinovitz authored and Linus Torvalds committed Oct 3, 2006
1 parent e90dae1 commit e3f6ac6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/md/dm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit e3f6ac6

Please sign in to comment.