diff options
author | Peter Zijlstra <a.p.zijlstra@chello.nl> | 2006-12-08 05:36:18 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.osdl.org> | 2006-12-08 11:28:39 -0500 |
commit | c48f70c3d046f021b1c22438604ef2a583380eca (patch) | |
tree | 88d38aeafa299c15d797cde4a2ef6afd81b82f07 | |
parent | d63a5a74dee87883fda6b7d170244acaac5b05e8 (diff) |
[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>
-rw-r--r-- | fs/block_dev.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/block_dev.c b/fs/block_dev.c index 846f32d51be7..f3c3a44dd8b6 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c | |||
@@ -902,6 +902,7 @@ EXPORT_SYMBOL(bd_set_size); | |||
902 | 902 | ||
903 | static int __blkdev_get(struct block_device *bdev, mode_t mode, unsigned flags, | 903 | static int __blkdev_get(struct block_device *bdev, mode_t mode, unsigned flags, |
904 | int for_part); | 904 | int for_part); |
905 | static int __blkdev_put(struct block_device *bdev, int for_part); | ||
905 | 906 | ||
906 | static int do_open(struct block_device *bdev, struct file *file, int for_part) | 907 | static int do_open(struct block_device *bdev, struct file *file, int for_part) |
907 | { | 908 | { |
@@ -987,7 +988,7 @@ out_first: | |||
987 | bdev->bd_disk = NULL; | 988 | bdev->bd_disk = NULL; |
988 | bdev->bd_inode->i_data.backing_dev_info = &default_backing_dev_info; | 989 | bdev->bd_inode->i_data.backing_dev_info = &default_backing_dev_info; |
989 | if (bdev != bdev->bd_contains) | 990 | if (bdev != bdev->bd_contains) |
990 | blkdev_put(bdev->bd_contains); | 991 | __blkdev_put(bdev->bd_contains, 1); |
991 | bdev->bd_contains = NULL; | 992 | bdev->bd_contains = NULL; |
992 | put_disk(disk); | 993 | put_disk(disk); |
993 | module_put(owner); | 994 | module_put(owner); |