Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 82666020 authored by Al Viro's avatar Al Viro
Browse files

[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: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 77e69dac
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -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;