From: Peter Zijlstra Date: Fri, 8 Dec 2006 10:36:18 +0000 (-0800) Subject: [PATCH] bdev: fix ->bd_part_count leak X-Git-Tag: v2.6.20-rc1~34^2~383 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=c48f70c3d046f021b1c22438604ef2a583380eca;p=linux-2.6-omap-h63xx.git [PATCH] bdev: fix ->bd_part_count leak Don't leak a ->bd_part_count when the partition open fails with -ENXIO. Signed-off-by: Peter Zijlstra Acked-by: Neil Brown Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/fs/block_dev.c b/fs/block_dev.c index 846f32d51be..f3c3a44dd8b 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c @@ -902,6 +902,7 @@ EXPORT_SYMBOL(bd_set_size); static int __blkdev_get(struct block_device *bdev, mode_t mode, unsigned flags, int for_part); +static int __blkdev_put(struct block_device *bdev, int for_part); static int do_open(struct block_device *bdev, struct file *file, int for_part) { @@ -987,7 +988,7 @@ out_first: bdev->bd_disk = NULL; bdev->bd_inode->i_data.backing_dev_info = &default_backing_dev_info; if (bdev != bdev->bd_contains) - blkdev_put(bdev->bd_contains); + __blkdev_put(bdev->bd_contains, 1); bdev->bd_contains = NULL; put_disk(disk); module_put(owner);