Commit a400a793 authored by Eric W. Biederman's avatar Eric W. Biederman Committed by Greg Kroah-Hartman

mnt: If fs_fully_visible fails call put_filesystem.

commit 97c1df3e upstream.

Add this trivial missing error handling.

Fixes: 1b852bce ("mnt: Refactor the logic for mounting sysfs and proc in a user namespace")
Signed-off-by: default avatar"Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 6256d2f5
...@@ -2401,10 +2401,12 @@ static int do_new_mount(struct path *path, const char *fstype, int flags, ...@@ -2401,10 +2401,12 @@ static int do_new_mount(struct path *path, const char *fstype, int flags,
mnt_flags |= MNT_NODEV | MNT_LOCK_NODEV; mnt_flags |= MNT_NODEV | MNT_LOCK_NODEV;
} }
if (type->fs_flags & FS_USERNS_VISIBLE) { if (type->fs_flags & FS_USERNS_VISIBLE) {
if (!fs_fully_visible(type, &mnt_flags)) if (!fs_fully_visible(type, &mnt_flags)) {
put_filesystem(type);
return -EPERM; return -EPERM;
} }
} }
}
mnt = vfs_kern_mount(type, flags, name, data); mnt = vfs_kern_mount(type, flags, name, data);
if (!IS_ERR(mnt) && (type->fs_flags & FS_HAS_SUBTYPE) && if (!IS_ERR(mnt) && (type->fs_flags & FS_HAS_SUBTYPE) &&
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment