summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorStas Sergeev <stsp@aknet.ru>2006-12-06 20:35:25 -0800
committerLinus Torvalds <torvalds@woody.osdl.org>2006-12-07 08:39:30 -0800
commit317a40ac2237732aba531eee2c7b5e39dd40e959 (patch)
tree8171e98eaa2bbceeacca4f4f43da1bb331ed17de /fs
parented07536ed6731775219c1df7fa26a7588753e693 (diff)
downloadlinux-3.10-317a40ac2237732aba531eee2c7b5e39dd40e959.tar.gz
linux-3.10-317a40ac2237732aba531eee2c7b5e39dd40e959.tar.bz2
linux-3.10-317a40ac2237732aba531eee2c7b5e39dd40e959.zip
[PATCH] honour MNT_NOEXEC for access()
Make access(X_OK) take the "noexec" mount option into account. Signed-off-by: Stas Sergeev <stsp@aknet.ru> Cc: Jakub Jelinek <jakub@redhat.com> Cc: Arjan van de Ven <arjan@infradead.org> Cc: Alan Cox <alan@lxorguk.ukuu.org.uk> Cc: Hugh Dickins <hugh@veritas.com> Cc: Ulrich Drepper <drepper@redhat.com> Cc: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/namei.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/fs/namei.c b/fs/namei.c
index 28d49b301d5..61f99c1967d 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -249,9 +249,11 @@ int permission(struct inode *inode, int mask, struct nameidata *nd)
/*
* MAY_EXEC on regular files requires special handling: We override
- * filesystem execute permissions if the mode bits aren't set.
+ * filesystem execute permissions if the mode bits aren't set or
+ * the fs is mounted with the "noexec" flag.
*/
- if ((mask & MAY_EXEC) && S_ISREG(mode) && !(mode & S_IXUGO))
+ if ((mask & MAY_EXEC) && S_ISREG(mode) && (!(mode & S_IXUGO) ||
+ (nd && nd->mnt && (nd->mnt->mnt_flags & MNT_NOEXEC))))
return -EACCES;
/* Ordinary permission routines do not understand MAY_APPEND. */