do_mount(): fix a leak introduced in 3.9 ("mount: consolidate permission checks")
authorAl Viro <viro@zeniv.linux.org.uk>
Sat, 4 May 2013 18:40:51 +0000 (14:40 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Sat, 4 May 2013 18:40:51 +0000 (14:40 -0400)
Cc: stable@vger.kernel.org
Bisected-by: Michael Leun <lkml20130126@newton.leun.net>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/namespace.c

index b4f96a5230a3874ebde148f42eedba02207e0c20..b68eef2d592ab2c51fc89389b179963fcd95e4a8 100644 (file)
@@ -2284,12 +2284,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;