aboutsummaryrefslogtreecommitdiffstats
path: root/fs/open.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/open.c')
-rw-r--r--fs/open.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/fs/open.c b/fs/open.c
index 3b3c43674be3..d5e421ad0cf6 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -461,6 +461,16 @@ asmlinkage long sys_faccessat(int dfd, const char __user *filename, int mode)
461 if (res) 461 if (res)
462 goto out; 462 goto out;
463 463
464 if ((mode & MAY_EXEC) && S_ISREG(nd.path.dentry->d_inode->i_mode)) {
465 /*
466 * MAY_EXEC on regular files is denied if the fs is mounted
467 * with the "noexec" flag.
468 */
469 res = -EACCES;
470 if (nd.path.mnt->mnt_flags & MNT_NOEXEC)
471 goto out_path_release;
472 }
473
464 res = vfs_permission(&nd, mode | MAY_ACCESS); 474 res = vfs_permission(&nd, mode | MAY_ACCESS);
465 /* SuS v2 requires we report a read only fs too */ 475 /* SuS v2 requires we report a read only fs too */
466 if(res || !(mode & S_IWOTH) || 476 if(res || !(mode & S_IWOTH) ||