]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - fs/exec.c
[PATCH] take noexec checks to very few callers that care
[net-next-2.6.git] / fs / exec.c
index 346e3f69c6e0ed38cb4d9048a081a76e2b5ece98..eca58c29eded6cd68d6d9a9205f04301fa33de6b 100644 (file)
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -118,6 +118,10 @@ asmlinkage long sys_uselib(const char __user * library)
        if (!S_ISREG(nd.path.dentry->d_inode->i_mode))
                goto exit;
 
+       error = -EACCES;
+       if (nd.path.mnt->mnt_flags & MNT_NOEXEC)
+               goto exit;
+
        error = vfs_permission(&nd, MAY_READ | MAY_EXEC | MAY_OPEN);
        if (error)
                goto exit;
@@ -668,6 +672,9 @@ struct file *open_exec(const char *name)
        if (!S_ISREG(nd.path.dentry->d_inode->i_mode))
                goto out_path_put;
 
+       if (nd.path.mnt->mnt_flags & MNT_NOEXEC)
+               goto out_path_put;
+
        err = vfs_permission(&nd, MAY_EXEC | MAY_OPEN);
        if (err)
                goto out_path_put;