summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2009-04-06 09:38:49 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2009-05-09 10:49:42 -0400
commita44ddbb6d8a8ffe4e34e417048dfdd8f3dd1de4f (patch)
treea5f9962f00d8a7b2640682fffd6aefd3544b1fd3
parente24977d45f45d1675e050dc1a0aaf4bfc4ca9866 (diff)
downloadlinux-a44ddbb6d8a8ffe4e34e417048dfdd8f3dd1de4f.tar.bz2
Make open_exec() and sys_uselib() use may_open(), instead of duplicating its parts
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r--fs/exec.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/fs/exec.c b/fs/exec.c
index 639177b0eeac..41ae8e0de72d 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -126,11 +126,7 @@ SYSCALL_DEFINE1(uselib, const char __user *, library)
if (nd.path.mnt->mnt_flags & MNT_NOEXEC)
goto exit;
- error = inode_permission(nd.path.dentry->d_inode,
- MAY_READ | MAY_EXEC | MAY_OPEN);
- if (error)
- goto exit;
- error = ima_path_check(&nd.path, MAY_READ | MAY_EXEC | MAY_OPEN);
+ error = may_open(&nd.path, MAY_READ | MAY_EXEC | MAY_OPEN, 0);
if (error)
goto exit;
@@ -677,10 +673,7 @@ struct file *open_exec(const char *name)
if (nd.path.mnt->mnt_flags & MNT_NOEXEC)
goto out_path_put;
- err = inode_permission(nd.path.dentry->d_inode, MAY_EXEC | MAY_OPEN);
- if (err)
- goto out_path_put;
- err = ima_path_check(&nd.path, MAY_EXEC | MAY_OPEN);
+ err = may_open(&nd.path, MAY_EXEC | MAY_OPEN, 0);
if (err)
goto out_path_put;