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

Commit 5d3bc605 authored by Al Viro's avatar Al Viro
Browse files

cifs: allocate mountdata earlier



pull mountdata allocation up, so that it won't stand in the way when
we lift cifs_mount() to location before sget().

Acked-by: default avatarPavel Shilovsky <piastryyy@gmail.com>
Reviewed-by: default avatarJeff Layton <jlayton@redhat.com>
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent d687ca38
Loading
Loading
Loading
Loading
+10 −11
Original line number Original line Diff line number Diff line
@@ -687,6 +687,14 @@ cifs_do_mount(struct file_system_type *fs_type,
		goto out;
		goto out;
	}
	}


	cifs_sb->mountdata = kstrndup(data, PAGE_SIZE, GFP_KERNEL);
	if (cifs_sb->mountdata == NULL) {
		root = ERR_PTR(-ENOMEM);
		unload_nls(volume_info->local_nls);
		kfree(cifs_sb);
		goto out;
	}

	cifs_setup_cifs_sb(volume_info, cifs_sb);
	cifs_setup_cifs_sb(volume_info, cifs_sb);


	mnt_data.vol = volume_info;
	mnt_data.vol = volume_info;
@@ -701,22 +709,12 @@ cifs_do_mount(struct file_system_type *fs_type,


	if (sb->s_fs_info) {
	if (sb->s_fs_info) {
		cFYI(1, "Use existing superblock");
		cFYI(1, "Use existing superblock");
		kfree(cifs_sb->mountdata);
		unload_nls(cifs_sb->local_nls);
		unload_nls(cifs_sb->local_nls);
		kfree(cifs_sb);
		kfree(cifs_sb);
		goto out_shared;
		goto out_shared;
	}
	}


	/*
	 * Copy mount params for use in submounts. Better to do
	 * the copy here and deal with the error before cleanup gets
	 * complicated post-mount.
	 */
	cifs_sb->mountdata = kstrndup(data, PAGE_SIZE, GFP_KERNEL);
	if (cifs_sb->mountdata == NULL) {
		root = ERR_PTR(-ENOMEM);
		goto out_super;
	}

	sb->s_flags = flags;
	sb->s_flags = flags;
	/* BB should we make this contingent on mount parm? */
	/* BB should we make this contingent on mount parm? */
	sb->s_flags |= MS_NODIRATIME | MS_NOATIME;
	sb->s_flags |= MS_NODIRATIME | MS_NOATIME;
@@ -749,6 +747,7 @@ cifs_do_mount(struct file_system_type *fs_type,
	goto out;
	goto out;


out_cifs_sb:
out_cifs_sb:
	kfree(cifs_sb->mountdata);
	unload_nls(cifs_sb->local_nls);
	unload_nls(cifs_sb->local_nls);
	kfree(cifs_sb);
	kfree(cifs_sb);