Commit cb9179ead0aa0e3b7b4087cdba59baf16bbeef6d

Authored by Linus Torvalds
1 parent f1ac9f6bfe

Simplify exec_permission_lite(), part 3

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>

Showing 1 changed file with 6 additions and 2 deletions Side-by-side Diff

... ... @@ -434,8 +434,12 @@
434 434 {
435 435 umode_t mode = inode->i_mode;
436 436  
437   - if (inode->i_op->permission)
438   - return inode_permission(inode, MAY_EXEC);
  437 + if (inode->i_op->permission) {
  438 + int ret = inode->i_op->permission(inode, MAY_EXEC);
  439 + if (!ret)
  440 + goto ok;
  441 + return ret;
  442 + }
439 443  
440 444 if (current_fsuid() == inode->i_uid)
441 445 mode >>= 6;