Commit f23c8af8 authored by Ilya Dryomov's avatar Ilya Dryomov

Btrfs: fix subvol_name leak on error in btrfs_mount()

btrfs_parse_early_options() can fail due to error while scanning devices
(-o device= option), but still strdup() subvol_name string:

mount -o subvol=SUBV,device=BAD_DEVICE <dev> <mnt>

So free subvol_name string on error.
Signed-off-by: default avatarIlya Dryomov <idryomov@gmail.com>
parent a90e8b6f
......@@ -905,8 +905,10 @@ static struct dentry *btrfs_mount(struct file_system_type *fs_type, int flags,
error = btrfs_parse_early_options(data, mode, fs_type,
&subvol_name, &subvol_objectid,
&subvol_rootid, &fs_devices);
if (error)
if (error) {
kfree(subvol_name);
return ERR_PTR(error);
}
if (subvol_name) {
root = mount_subvol(subvol_name, flags, device_name, data);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment