aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/cifs/cifsfs.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
index 4162ee45d04..ec19161dd27 100644
--- a/fs/cifs/cifsfs.c
+++ b/fs/cifs/cifsfs.c
@@ -687,6 +687,14 @@ cifs_do_mount(struct file_system_type *fs_type,
687 goto out; 687 goto out;
688 } 688 }
689 689
690 cifs_sb->mountdata = kstrndup(data, PAGE_SIZE, GFP_KERNEL);
691 if (cifs_sb->mountdata == NULL) {
692 root = ERR_PTR(-ENOMEM);
693 unload_nls(volume_info->local_nls);
694 kfree(cifs_sb);
695 goto out;
696 }
697
690 cifs_setup_cifs_sb(volume_info, cifs_sb); 698 cifs_setup_cifs_sb(volume_info, cifs_sb);
691 699
692 mnt_data.vol = volume_info; 700 mnt_data.vol = volume_info;
@@ -701,22 +709,12 @@ cifs_do_mount(struct file_system_type *fs_type,
701 709
702 if (sb->s_fs_info) { 710 if (sb->s_fs_info) {
703 cFYI(1, "Use existing superblock"); 711 cFYI(1, "Use existing superblock");
712 kfree(cifs_sb->mountdata);
704 unload_nls(cifs_sb->local_nls); 713 unload_nls(cifs_sb->local_nls);
705 kfree(cifs_sb); 714 kfree(cifs_sb);
706 goto out_shared; 715 goto out_shared;
707 } 716 }
708 717
709 /*
710 * Copy mount params for use in submounts. Better to do
711 * the copy here and deal with the error before cleanup gets
712 * complicated post-mount.
713 */
714 cifs_sb->mountdata = kstrndup(data, PAGE_SIZE, GFP_KERNEL);
715 if (cifs_sb->mountdata == NULL) {
716 root = ERR_PTR(-ENOMEM);
717 goto out_super;
718 }
719
720 sb->s_flags = flags; 718 sb->s_flags = flags;
721 /* BB should we make this contingent on mount parm? */ 719 /* BB should we make this contingent on mount parm? */
722 sb->s_flags |= MS_NODIRATIME | MS_NOATIME; 720 sb->s_flags |= MS_NODIRATIME | MS_NOATIME;
@@ -749,6 +747,7 @@ out_super:
749 goto out; 747 goto out;
750 748
751out_cifs_sb: 749out_cifs_sb:
750 kfree(cifs_sb->mountdata);
752 unload_nls(cifs_sb->local_nls); 751 unload_nls(cifs_sb->local_nls);
753 kfree(cifs_sb); 752 kfree(cifs_sb);
754 753