Commit c48f70c3 authored by Peter Zijlstra's avatar Peter Zijlstra Committed by Linus Torvalds

[PATCH] bdev: fix ->bd_part_count leak

Don't leak a ->bd_part_count when the partition open fails with -ENXIO.
Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
Acked-by: default avatarNeil Brown <neilb@suse.de>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent d63a5a74
...@@ -902,6 +902,7 @@ EXPORT_SYMBOL(bd_set_size); ...@@ -902,6 +902,7 @@ EXPORT_SYMBOL(bd_set_size);
static int __blkdev_get(struct block_device *bdev, mode_t mode, unsigned flags, static int __blkdev_get(struct block_device *bdev, mode_t mode, unsigned flags,
int for_part); 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) static int do_open(struct block_device *bdev, struct file *file, int for_part)
{ {
...@@ -987,7 +988,7 @@ static int do_open(struct block_device *bdev, struct file *file, int for_part) ...@@ -987,7 +988,7 @@ static int do_open(struct block_device *bdev, struct file *file, int for_part)
bdev->bd_disk = NULL; bdev->bd_disk = NULL;
bdev->bd_inode->i_data.backing_dev_info = &default_backing_dev_info; bdev->bd_inode->i_data.backing_dev_info = &default_backing_dev_info;
if (bdev != bdev->bd_contains) if (bdev != bdev->bd_contains)
blkdev_put(bdev->bd_contains); __blkdev_put(bdev->bd_contains, 1);
bdev->bd_contains = NULL; bdev->bd_contains = NULL;
put_disk(disk); put_disk(disk);
module_put(owner); module_put(owner);
......
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