mirror of
https://github.com/torvalds/linux.git
synced 2024-11-10 22:21:40 +00:00
[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>
This commit is contained in:
parent
77e69dac3c
commit
8266602033
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user