From: Al Viro Date: Sat, 4 May 2013 18:40:51 +0000 (-0400) Subject: do_mount(): fix a leak introduced in 3.9 ("mount: consolidate permission checks") X-Git-Tag: v3.9.1~9 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=6f956c7dee5235a2cf09605216c5c782164f4062;p=karo-tx-linux.git do_mount(): fix a leak introduced in 3.9 ("mount: consolidate permission checks") commit 0d5cadb87e0fa764db7fa0b78d8a6f173cb475a1 upstream. Bisected-by: Michael Leun Signed-off-by: Al Viro Signed-off-by: Greg Kroah-Hartman --- diff --git a/fs/namespace.c b/fs/namespace.c index 341d3f564082..e945b81be7d4 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;