diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2008-08-01 05:32:04 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2008-08-01 11:25:26 -0400 |
commit | 8266602033d6adc6d10cb8811c1fd694767909b0 (patch) | |
tree | 4a8a87ebf88bf184bf47e8c505df6e94571eb0d7 | |
parent | 77e69dac3cefacee939cb107ae9cd520a62338e0 (diff) | |
download | kernel_samsung_smdk4412-8266602033d6adc6d10cb8811c1fd694767909b0.zip kernel_samsung_smdk4412-8266602033d6adc6d10cb8811c1fd694767909b0.tar.gz kernel_samsung_smdk4412-8266602033d6adc6d10cb8811c1fd694767909b0.tar.bz2 |
[PATCH] fix bdev leak in block_dev.c do_open()
Callers expect it to drop reference to bdev on all failure exits.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r-- | fs/block_dev.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/block_dev.c b/fs/block_dev.c index dcf37ca..e664b0b 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c @@ -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; |