Skip to content

Commit

Permalink
cifs: more breakage on mount failures
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Al Viro committed Jun 24, 2011
1 parent ee01a14 commit fa18f1b
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions fs/cifs/cifsfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -710,19 +710,16 @@ cifs_do_mount(struct file_system_type *fs_type,

sb->s_flags |= MS_ACTIVE;

out_shared:
root = cifs_get_root(volume_info, sb);
if (root == NULL)
if (root == NULL) {
root = ERR_PTR(-EINVAL); /* XXX */
goto out_super;
}

cFYI(1, "dentry root is: %p", root);
goto out;

out_shared:
root = cifs_get_root(volume_info, sb);
if (root)
cFYI(1, "dentry root is: %p", root);
goto out;

out_super:
deactivate_locked_super(sb);
out:
Expand Down

0 comments on commit fa18f1b

Please sign in to comment.