Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 257323
b: refs/heads/master
c: 4ad5abb
h: refs/heads/master
i:
  257321: af9e183
  257319: 3764a7e
v: v3
  • Loading branch information
Al Viro committed Jul 20, 2011
1 parent 5f1e969 commit 1448395
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 42 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d594e7ec4da6c1a527dea4965eee37cd785792b8
refs/heads/master: 4ad5abb3d01a2c10854969b00982fadb130784a6
45 changes: 4 additions & 41 deletions trunk/fs/namei.c
Original file line number Diff line number Diff line change
Expand Up @@ -310,43 +310,6 @@ int inode_permission(struct inode *inode, int mask)
return security_inode_permission(inode, mask);
}

/**
* exec_permission - check for right to do lookups in a given directory
* @inode: inode to check permission on
* @mask: MAY_EXEC and possibly MAY_NOT_BLOCK flags.
*
* Short-cut version of inode_permission(), for calling on directories
* during pathname resolution. Combines parts of inode_permission()
* and generic_permission(), and tests ONLY for MAY_EXEC permission.
*
* If appropriate, check DAC only. If not appropriate, or
* short-cut DAC fails, then call ->permission() to do more
* complete permission check.
*/
static inline int exec_permission(struct inode *inode, int mask)
{
int ret;
struct user_namespace *ns = inode_userns(inode);

if (inode->i_op->permission) {
ret = inode->i_op->permission(inode, mask);
if (likely(!ret))
goto ok;
} else {
ret = acl_permission_check(inode, mask);
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;
}
return ret;
ok:
return security_inode_permission(inode, mask);
}

/**
* path_get - get a reference to a path
* @path: path to get the reference to
Expand Down Expand Up @@ -1220,13 +1183,13 @@ static int do_lookup(struct nameidata *nd, struct qstr *name,
static inline int may_lookup(struct nameidata *nd)
{
if (nd->flags & LOOKUP_RCU) {
int err = exec_permission(nd->inode, MAY_EXEC|MAY_NOT_BLOCK);
int err = inode_permission(nd->inode, MAY_EXEC|MAY_NOT_BLOCK);
if (err != -ECHILD)
return err;
if (unlazy_walk(nd, NULL))
return -ECHILD;
}
return exec_permission(nd->inode, MAY_EXEC);
return inode_permission(nd->inode, MAY_EXEC);
}

static inline int handle_dots(struct nameidata *nd, int type)
Expand Down Expand Up @@ -1501,7 +1464,7 @@ static int path_init(int dfd, const char *name, unsigned int flags,
if (!S_ISDIR(dentry->d_inode->i_mode))
goto fput_fail;

retval = exec_permission(dentry->d_inode, MAY_EXEC);
retval = inode_permission(dentry->d_inode, MAY_EXEC);
if (retval)
goto fput_fail;
}
Expand Down Expand Up @@ -1658,7 +1621,7 @@ static struct dentry *__lookup_hash(struct qstr *name,
struct dentry *dentry;
int err;

err = exec_permission(inode, MAY_EXEC);
err = inode_permission(inode, MAY_EXEC);
if (err)
return ERR_PTR(err);

Expand Down

0 comments on commit 1448395

Please sign in to comment.