Skip to content

Commit

Permalink
[PATCH] fix bdev leak in block_dev.c do_open()
Browse files Browse the repository at this point in the history
Callers expect it to drop reference to bdev on all failure exits.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
  • Loading branch information
Al Viro committed Aug 1, 2008
1 parent 77e69da commit 8266602
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion fs/block_dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -941,8 +941,10 @@ static int do_open(struct block_device *bdev, struct file *file, int for_part)
* hooks: /n/, see "layering violations".
*/
ret = devcgroup_inode_permission(bdev->bd_inode, perm);
if (ret != 0)
if (ret != 0) {
bdput(bdev);
return ret;
}

ret = -ENXIO;
file->f_mapping = bdev->bd_inode->i_mapping;
Expand Down

0 comments on commit 8266602

Please sign in to comment.