forked from Minki/linux
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 <mszeredi@suse.cz> Cc: Al Viro <viro@zeniv.linux.org.uk> Cc: Christoph Hellwig <hch@lst.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
22590e41cb
commit
1a159dd229
@ -112,9 +112,6 @@ asmlinkage long sys_uselib(const char __user * library)
|
|||||||
if (error)
|
if (error)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
error = -EACCES;
|
|
||||||
if (nd.mnt->mnt_flags & MNT_NOEXEC)
|
|
||||||
goto exit;
|
|
||||||
error = -EINVAL;
|
error = -EINVAL;
|
||||||
if (!S_ISREG(nd.dentry->d_inode->i_mode))
|
if (!S_ISREG(nd.dentry->d_inode->i_mode))
|
||||||
goto exit;
|
goto exit;
|
||||||
@ -658,8 +655,7 @@ struct file *open_exec(const char *name)
|
|||||||
if (!err) {
|
if (!err) {
|
||||||
struct inode *inode = nd.dentry->d_inode;
|
struct inode *inode = nd.dentry->d_inode;
|
||||||
file = ERR_PTR(-EACCES);
|
file = ERR_PTR(-EACCES);
|
||||||
if (!(nd.mnt->mnt_flags & MNT_NOEXEC) &&
|
if (S_ISREG(inode->i_mode)) {
|
||||||
S_ISREG(inode->i_mode)) {
|
|
||||||
int err = vfs_permission(&nd, MAY_EXEC);
|
int err = vfs_permission(&nd, MAY_EXEC);
|
||||||
file = ERR_PTR(err);
|
file = ERR_PTR(err);
|
||||||
if (!err) {
|
if (!err) {
|
||||||
|
Loading…
Reference in New Issue
Block a user