Skip to content

Commit

Permalink
[PATCH] bdev: fix ->bd_part_count leak
Browse files Browse the repository at this point in the history
Don't leak a ->bd_part_count when the partition open fails with -ENXIO.

Signed-off-by: Peter Zijlstra <[email protected]>
Acked-by: Neil Brown <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Peter Zijlstra authored and Linus Torvalds committed Dec 8, 2006
1 parent d63a5a7 commit c48f70c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion fs/block_dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -987,7 +988,7 @@ static int do_open(struct block_device *bdev, struct file *file, int for_part)
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);
Expand Down

0 comments on commit c48f70c

Please sign in to comment.