[patch 4/9] exec: remove unnecessary check for MNT_NOEXEC

From: miklos
Date: Thu Aug 09 2007 - 05:27:17 EST


From: Miklos Szeredi <mszeredi@xxxxxxx>

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 <mszeredi@xxxxxxx>
---

Index: linux/fs/exec.c
===================================================================
--- linux.orig/fs/exec.c 2007-08-09 11:01:54.000000000 +0200
+++ linux/fs/exec.c 2007-08-09 11:04:24.000000000 +0200
@@ -113,9 +113,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;
@@ -659,8 +656,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) {

--
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/