]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 8 May 2013 03:33:14 +0000 (20:33 -0700)
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>
fs/namespace.c

index 341d3f564082f2367a7f1538255e90bdfbfd8cd2..e945b81be7d40006e382e225b86256b411d8b9ee 100644 (file)
@@ -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;