aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-08-28 11:08:31 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2009-09-08 11:07:44 -0700
commitcb9179ead0aa0e3b7b4087cdba59baf16bbeef6d (patch)
tree04d91abc90dc3f48d70bc95bc9bed6f561369008
parentf1ac9f6bfea6f21e8ab6dbbe46879d62a6fba8c0 (diff)
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>
-rw-r--r--fs/namei.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/fs/namei.c b/fs/namei.c
index 929f535fb22..e645e307036 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -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;