summaryrefslogtreecommitdiff
path: root/fs/namei.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/namei.c')
-rw-r--r--fs/namei.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/fs/namei.c b/fs/namei.c
index 5ba42c453e31..7c8a93042e63 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -584,19 +584,19 @@ static inline int exec_permission(struct inode *inode, unsigned int flags)
if (inode->i_op->permission) {
ret = inode->i_op->permission(inode, MAY_EXEC, flags);
+ if (likely(!ret))
+ goto ok;
} else {
ret = acl_permission_check(inode, MAY_EXEC, flags,
inode->i_op->check_acl);
+ if (likely(!ret))
+ goto ok;
+ if (ret != -EACCES)
+ return ret;
+ if (ns_capable(ns, CAP_DAC_OVERRIDE) ||
+ ns_capable(ns, CAP_DAC_READ_SEARCH))
+ goto ok;
}
- if (likely(!ret))
- goto ok;
- if (ret == -ECHILD)
- return ret;
-
- if (ns_capable(ns, CAP_DAC_OVERRIDE) ||
- ns_capable(ns, CAP_DAC_READ_SEARCH))
- goto ok;
-
return ret;
ok:
return security_inode_exec_permission(inode, flags);