Skip to content

Commit

Permalink
Simplify exec_permission_lite(), part 3
Browse files Browse the repository at this point in the history
Don't call down to the generic inode_permission() function just to
call the inode-specific permission function - just do it directly.

The generic inode_permission() code does things like checking MAY_WRITE
and devcgroup_inode_permission(), neither of which are relevant for the
light pathname walk permission checks (we always do just MAY_EXEC, and
the inode is never a special device).

Reviewed-by: James Morris <jmorris@namei.org>
Acked-by: Serge Hallyn <serue@us.ibm.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Linus Torvalds committed Sep 8, 2009
1 parent f1ac9f6 commit cb9179e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions fs/namei.c
Original file line number Diff line number Diff line change
Expand Up @@ -434,8 +434,12 @@ static int exec_permission_lite(struct inode *inode)
{
umode_t mode = inode->i_mode;

if (inode->i_op->permission)
return inode_permission(inode, MAY_EXEC);
if (inode->i_op->permission) {
int ret = inode->i_op->permission(inode, MAY_EXEC);
if (!ret)
goto ok;
return ret;
}

if (current_fsuid() == inode->i_uid)
mode >>= 6;
Expand Down

0 comments on commit cb9179e

Please sign in to comment.