mnt: If fs_fully_visible fails call put_filesystem.
authorEric W. Biederman <ebiederm@xmission.com>
Mon, 6 Jun 2016 20:36:07 +0000 (15:36 -0500)
committerEric W. Biederman <ebiederm@xmission.com>
Tue, 7 Jun 2016 01:48:31 +0000 (20:48 -0500)
Add this trivial missing error handling.

Cc: stable@vger.kernel.org
Fixes: 1b852bceb0d1 ("mnt: Refactor the logic for mounting sysfs and proc in a user namespace")
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
fs/namespace.c

index 4fb1691b435552c044134b56aa2032da35684b5b..9d45c8a3414f7682e421db6de39c4b55c3b85e9a 100644 (file)
@@ -2409,8 +2409,10 @@ static int do_new_mount(struct path *path, const char *fstype, int flags,
                        mnt_flags |= MNT_NODEV | MNT_LOCK_NODEV;
                }
                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;
+                       }
                }
        }