From: Zdenek Kabelac Date: Fri, 16 Oct 2009 22:18:15 +0000 (+0100) Subject: dm: add missing del_gendisk to alloc_dev error path X-Git-Tag: v2.6.31.6~80 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=17f34f975f03e1cdad57fc04c590a750e2558d42;p=thirdparty%2Fkernel%2Fstable.git dm: add missing del_gendisk to alloc_dev error path commit 03022c54b9725026c0370a810168975c387ad04c upstream. Add missing del_gendisk() to error path when creation of workqueue fails. Otherwice there is a resource leak and following warning is shown: WARNING: at fs/sysfs/dir.c:487 sysfs_add_one+0xc5/0x160() sysfs: cannot create duplicate filename '/devices/virtual/block/dm-0' Signed-off-by: Zdenek Kabelac Reviewed-by: Jonathan Brassow Signed-off-by: Alasdair G Kergon Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/md/dm.c b/drivers/md/dm.c index b4845b14740d6..bf5961df5481b 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c @@ -1819,6 +1819,7 @@ static struct mapped_device *alloc_dev(int minor) bad_bdev: destroy_workqueue(md->wq); bad_thread: + del_gendisk(md->disk); put_disk(md->disk); bad_disk: blk_cleanup_queue(md->queue);