aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2011-06-17 09:50:44 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2011-06-24 18:39:42 -0400
commitfa18f1bdce898f0efd0c8639c901d826d01be04f (patch)
tree1165e5c3172792bf9d9ce4340380b9e7c73b7499
parentee01a14d9ddcf3f832f9ceb837888501cb496e27 (diff)
cifs: more breakage on mount failures
if cifs_get_root() fails, we end up with ->mount() returning NULL, which is not what callers expect. Moreover, in case of superblock reuse we end up leaking a superblock reference... Acked-by: Pavel Shilovsky <piastryyy@gmail.com> Reviewed-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r--fs/cifs/cifsfs.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
index ba2b2da360d..234e9d08db7 100644
--- a/fs/cifs/cifsfs.c
+++ b/fs/cifs/cifsfs.c
@@ -710,19 +710,16 @@ cifs_do_mount(struct file_system_type *fs_type,
710 710
711 sb->s_flags |= MS_ACTIVE; 711 sb->s_flags |= MS_ACTIVE;
712 712
713out_shared:
713 root = cifs_get_root(volume_info, sb); 714 root = cifs_get_root(volume_info, sb);
714 if (root == NULL) 715 if (root == NULL) {
716 root = ERR_PTR(-EINVAL); /* XXX */
715 goto out_super; 717 goto out_super;
718 }
716 719
717 cFYI(1, "dentry root is: %p", root); 720 cFYI(1, "dentry root is: %p", root);
718 goto out; 721 goto out;
719 722
720out_shared:
721 root = cifs_get_root(volume_info, sb);
722 if (root)
723 cFYI(1, "dentry root is: %p", root);
724 goto out;
725
726out_super: 723out_super:
727 deactivate_locked_super(sb); 724 deactivate_locked_super(sb);
728out: 725out: