From: Miklos Szeredi vfs_permission(MAY_EXEC) checks if the filesystem is mounted with "noexec", so there's no need to repeat this check in sys_uselib() and open_exec(). Signed-off-by: Miklos Szeredi Cc: Al Viro Cc: Christoph Hellwig Signed-off-by: Andrew Morton --- fs/exec.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff -puN fs/exec.c~exec-remove-unnecessary-check-for-mnt_noexec fs/exec.c --- a/fs/exec.c~exec-remove-unnecessary-check-for-mnt_noexec +++ a/fs/exec.c @@ -111,9 +111,6 @@ asmlinkage long sys_uselib(const char __ if (error) goto out; - error = -EACCES; - if (nd.mnt->mnt_flags & MNT_NOEXEC) - goto exit; error = -EINVAL; if (!S_ISREG(nd.dentry->d_inode->i_mode)) goto exit; @@ -658,8 +655,7 @@ struct file *open_exec(const char *name) if (!err) { struct inode *inode = nd.dentry->d_inode; file = ERR_PTR(-EACCES); - if (!(nd.mnt->mnt_flags & MNT_NOEXEC) && - S_ISREG(inode->i_mode)) { + if (S_ISREG(inode->i_mode)) { int err = vfs_permission(&nd, MAY_EXEC); file = ERR_PTR(err); if (!err) { _