Commit 52094c8a authored by Al Viro's avatar Al Viro

take RCU-dependent stuff around exec_permission() into a new helper

Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent c9c6cac0
...@@ -1322,6 +1322,18 @@ static int do_lookup(struct nameidata *nd, struct qstr *name, ...@@ -1322,6 +1322,18 @@ static int do_lookup(struct nameidata *nd, struct qstr *name,
return PTR_ERR(dentry); return PTR_ERR(dentry);
} }
static inline int may_lookup(struct nameidata *nd)
{
if (nd->flags & LOOKUP_RCU) {
int err = exec_permission(nd->inode, IPERM_FLAG_RCU);
if (err != -ECHILD)
return err;
if (nameidata_drop_rcu(nd))
return -ECHILD;
}
return exec_permission(nd->inode, 0);
}
/* /*
* Name resolution. * Name resolution.
* This is the basic name resolution function, turning a pathname into * This is the basic name resolution function, turning a pathname into
...@@ -1352,17 +1364,8 @@ static int link_path_walk(const char *name, struct nameidata *nd) ...@@ -1352,17 +1364,8 @@ static int link_path_walk(const char *name, struct nameidata *nd)
unsigned int c; unsigned int c;
nd->flags |= LOOKUP_CONTINUE; nd->flags |= LOOKUP_CONTINUE;
if (nd->flags & LOOKUP_RCU) {
err = exec_permission(nd->inode, IPERM_FLAG_RCU); err = may_lookup(nd);
if (err == -ECHILD) {
if (nameidata_drop_rcu(nd))
return -ECHILD;
goto exec_again;
}
} else {
exec_again:
err = exec_permission(nd->inode, 0);
}
if (err) if (err)
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment