[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 <a.p.zijlstra@chello.nl>
Acked-by: Neil Brown <neilb@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
Peter Zijlstra 2006-12-08 02:36:18 -08:00 committed by Linus Torvalds
parent d63a5a74de
commit c48f70c3d0
1 changed files with 2 additions and 1 deletions

View File

@ -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);