mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-02 16:44:10 +08:00
Make open_exec() and sys_uselib() use may_open(), instead of duplicating its parts
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
parent
e24977d45f
commit
a44ddbb6d8
11
fs/exec.c
11
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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user