From: Miklos Szeredi Date: Wed, 17 Oct 2007 06:27:08 +0000 (-0700) Subject: exec: remove unnecessary check for MNT_NOEXEC X-Git-Url: http://drtracing.org/?a=commitdiff_plain;h=1a159dd229e6a70e3ffd3f785cb51fa61b232279;p=deliverable%2Flinux.git exec: remove unnecessary check for MNT_NOEXEC 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 Signed-off-by: Linus Torvalds --- diff --git a/fs/exec.c b/fs/exec.c index cbd183daaad4..59c0038baa4f 100644 --- a/fs/exec.c +++ b/fs/exec.c @@ -112,9 +112,6 @@ asmlinkage long sys_uselib(const char __user * library) 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) {