aboutsummaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2013-05-04 14:40:51 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-05-07 20:33:14 -0700
commit6f956c7dee5235a2cf09605216c5c782164f4062 (patch)
tree88e6a6d2587f18b1a0fefa2e4162ae7b970d18c3 /fs
parentd9168e12111ea4a9bad9cb71b3c80bb989f839d4 (diff)
do_mount(): fix a leak introduced in 3.9 ("mount: consolidate permission checks")
commit 0d5cadb87e0fa764db7fa0b78d8a6f173cb475a1 upstream. Bisected-by: Michael Leun <lkml20130126@newton.leun.net> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/namespace.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/fs/namespace.c b/fs/namespace.c
index 341d3f56408..e945b81be7d 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -2238,12 +2238,11 @@ long do_mount(const char *dev_name, const char *dir_name,
retval = security_sb_mount(dev_name, &path,
type_page, flags, data_page);
+ if (!retval && !may_mount())
+ retval = -EPERM;
if (retval)
goto dput_out;
- if (!may_mount())
- return -EPERM;
-
/* Default to relatime unless overriden */
if (!(flags & MS_NOATIME))
mnt_flags |= MNT_RELATIME;