Commit f23c8af8ca2789eeb0ab9ea90c214f9694d96cc5
1 parent
a90e8b6fb8
Exists in
master
and in
6 other branches
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: Ilya Dryomov <idryomov@gmail.com>
Showing 1 changed file with 3 additions and 1 deletions Side-by-side Diff
fs/btrfs/super.c
... | ... | @@ -905,8 +905,10 @@ |
905 | 905 | error = btrfs_parse_early_options(data, mode, fs_type, |
906 | 906 | &subvol_name, &subvol_objectid, |
907 | 907 | &subvol_rootid, &fs_devices); |
908 | - if (error) | |
908 | + if (error) { | |
909 | + kfree(subvol_name); | |
909 | 910 | return ERR_PTR(error); |
911 | + } | |
910 | 912 | |
911 | 913 | if (subvol_name) { |
912 | 914 | root = mount_subvol(subvol_name, flags, device_name, data); |