From: Eric W. Biederman Date: Mon, 6 Jun 2016 20:36:07 +0000 (-0500) Subject: mnt: If fs_fully_visible fails call put_filesystem. X-Git-Tag: v4.1.12-92~15^2~130 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=71f3d3843cf6f08497b305ea7ed5e50ec2aa167f;p=users%2Fjedix%2Flinux-maple.git mnt: If fs_fully_visible fails call put_filesystem. Orabug: 25256941 [ Upstream commit 97c1df3e54e811aed484a036a798b4b25d002ecf ] 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" Signed-off-by: Sasha Levin (cherry picked from commit fced2a819164c305544bcc8d9a45beea15374528) Signed-off-by: Dhaval Giani --- diff --git a/fs/namespace.c b/fs/namespace.c index fce3cc1a3fa77..2b801290b2862 100644 --- a/fs/namespace.c +++ b/fs/namespace.c @@ -2390,8 +2390,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; + } } }