提交 82666020 编写于 作者: A Al Viro

[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: NAl Viro <viro@zeniv.linux.org.uk>
上级 77e69dac
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册