aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2011-06-17 09:47:23 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2011-06-24 18:39:42 -0400
commitee01a14d9ddcf3f832f9ceb837888501cb496e27 (patch)
treea0ae5b81a9b7b26ce4c4a8b412b85f779157b7c4 /fs
parentd757d71bfc30669a500b72792067e8d1c5d401a5 (diff)
cifs: close sget() races
have ->s_fs_info set by the set() callback passed to sget() Acked-by: Pavel Shilovsky <piastryyy@gmail.com> Reviewed-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs')
-rw-r--r--fs/cifs/cifsfs.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
index 46960b7ee433..ba2b2da360d3 100644
--- a/fs/cifs/cifsfs.c
+++ b/fs/cifs/cifsfs.c
@@ -629,6 +629,13 @@ out:
629 return dparent; 629 return dparent;
630} 630}
631 631
632static int cifs_set_super(struct super_block *sb, void *data)
633{
634 struct cifs_mnt_data *mnt_data = data;
635 sb->s_fs_info = mnt_data->cifs_sb;
636 return set_anon_super(sb, NULL);
637}
638
632static struct dentry * 639static struct dentry *
633cifs_do_mount(struct file_system_type *fs_type, 640cifs_do_mount(struct file_system_type *fs_type,
634 int flags, const char *dev_name, void *data) 641 int flags, const char *dev_name, void *data)
@@ -678,14 +685,14 @@ cifs_do_mount(struct file_system_type *fs_type,
678 mnt_data.cifs_sb = cifs_sb; 685 mnt_data.cifs_sb = cifs_sb;
679 mnt_data.flags = flags; 686 mnt_data.flags = flags;
680 687
681 sb = sget(fs_type, cifs_match_super, set_anon_super, &mnt_data); 688 sb = sget(fs_type, cifs_match_super, cifs_set_super, &mnt_data);
682 if (IS_ERR(sb)) { 689 if (IS_ERR(sb)) {
683 root = ERR_CAST(sb); 690 root = ERR_CAST(sb);
684 cifs_umount(cifs_sb); 691 cifs_umount(cifs_sb);
685 goto out; 692 goto out;
686 } 693 }
687 694
688 if (sb->s_fs_info) { 695 if (sb->s_root) {
689 cFYI(1, "Use existing superblock"); 696 cFYI(1, "Use existing superblock");
690 cifs_umount(cifs_sb); 697 cifs_umount(cifs_sb);
691 goto out_shared; 698 goto out_shared;
@@ -694,7 +701,6 @@ cifs_do_mount(struct file_system_type *fs_type,
694 sb->s_flags = flags; 701 sb->s_flags = flags;
695 /* BB should we make this contingent on mount parm? */ 702 /* BB should we make this contingent on mount parm? */
696 sb->s_flags |= MS_NODIRATIME | MS_NOATIME; 703 sb->s_flags |= MS_NODIRATIME | MS_NOATIME;
697 sb->s_fs_info = cifs_sb;
698 704
699 rc = cifs_read_super(sb); 705 rc = cifs_read_super(sb);
700 if (rc) { 706 if (rc) {