diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2009-04-06 09:38:49 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2009-05-09 10:49:42 -0400 |
commit | a44ddbb6d8a8ffe4e34e417048dfdd8f3dd1de4f (patch) | |
tree | a5f9962f00d8a7b2640682fffd6aefd3544b1fd3 /fs/exec.c | |
parent | e24977d45f45d1675e050dc1a0aaf4bfc4ca9866 (diff) |
Make open_exec() and sys_uselib() use may_open(), instead of duplicating its parts
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/exec.c')
-rw-r--r-- | fs/exec.c | 11 |
1 files changed, 2 insertions, 9 deletions
@@ -126,11 +126,7 @@ SYSCALL_DEFINE1(uselib, const char __user *, library) | |||
126 | if (nd.path.mnt->mnt_flags & MNT_NOEXEC) | 126 | if (nd.path.mnt->mnt_flags & MNT_NOEXEC) |
127 | goto exit; | 127 | goto exit; |
128 | 128 | ||
129 | error = inode_permission(nd.path.dentry->d_inode, | 129 | error = may_open(&nd.path, MAY_READ | MAY_EXEC | MAY_OPEN, 0); |
130 | MAY_READ | MAY_EXEC | MAY_OPEN); | ||
131 | if (error) | ||
132 | goto exit; | ||
133 | error = ima_path_check(&nd.path, MAY_READ | MAY_EXEC | MAY_OPEN); | ||
134 | if (error) | 130 | if (error) |
135 | goto exit; | 131 | goto exit; |
136 | 132 | ||
@@ -677,10 +673,7 @@ struct file *open_exec(const char *name) | |||
677 | if (nd.path.mnt->mnt_flags & MNT_NOEXEC) | 673 | if (nd.path.mnt->mnt_flags & MNT_NOEXEC) |
678 | goto out_path_put; | 674 | goto out_path_put; |
679 | 675 | ||
680 | err = inode_permission(nd.path.dentry->d_inode, MAY_EXEC | MAY_OPEN); | 676 | err = may_open(&nd.path, MAY_EXEC | MAY_OPEN, 0); |
681 | if (err) | ||
682 | goto out_path_put; | ||
683 | err = ima_path_check(&nd.path, MAY_EXEC | MAY_OPEN); | ||
684 | if (err) | 677 | if (err) |
685 | goto out_path_put; | 678 | goto out_path_put; |
686 | 679 | ||