Skip to content

Commit

Permalink
Make open_exec() and sys_uselib() use may_open(), instead of duplicat…
Browse files Browse the repository at this point in the history
…ing its parts

Signed-off-by: Al Viro <[email protected]>
  • Loading branch information
Al Viro committed May 9, 2009
1 parent e24977d commit a44ddbb
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions fs/exec.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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;

Expand Down

0 comments on commit a44ddbb

Please sign in to comment.