aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorIlya Dryomov <idryomov@gmail.com>2011-11-08 12:15:05 -0500
committerIlya Dryomov <idryomov@gmail.com>2011-11-09 15:53:38 -0500
commitf23c8af8ca2789eeb0ab9ea90c214f9694d96cc5 (patch)
treee1acd02447bc510609f14372d4aa4c1349ed6000 /fs
parenta90e8b6fb80db43b029e1e76205452afa8bdc77a (diff)
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>
Diffstat (limited to 'fs')
-rw-r--r--fs/btrfs/super.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index 6befcaf253bd..58e9492230ce 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -905,8 +905,10 @@ static struct dentry *btrfs_mount(struct file_system_type *fs_type, int flags,
905 error = btrfs_parse_early_options(data, mode, fs_type, 905 error = btrfs_parse_early_options(data, mode, fs_type,
906 &subvol_name, &subvol_objectid, 906 &subvol_name, &subvol_objectid,
907 &subvol_rootid, &fs_devices); 907 &subvol_rootid, &fs_devices);
908 if (error) 908 if (error) {
909 kfree(subvol_name);
909 return ERR_PTR(error); 910 return ERR_PTR(error);
911 }
910 912
911 if (subvol_name) { 913 if (subvol_name) {
912 root = mount_subvol(subvol_name, flags, device_name, data); 914 root = mount_subvol(subvol_name, flags, device_name, data);