summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2011-02-22 05:34:47 +0300
committerAl Viro <viro@zeniv.linux.org.uk>2011-03-14 16:15:23 +0300
commit52094c8a0610cf57920ad4c6c57470ae2ccbbd25 (patch)
tree1601d55c395248a429eb1c0fddc1c23094694024 /fs
parentc9c6cac0c2bdbda42e7b804838648d0bc60ddb13 (diff)
downloadlinux-52094c8a0610cf57920ad4c6c57470ae2ccbbd25.tar.xz
take RCU-dependent stuff around exec_permission() into a new helper
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs')
-rw-r--r--fs/namei.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/fs/namei.c b/fs/namei.c
index 1d6bc8151553..8c704465f6ce 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -1322,6 +1322,18 @@ fail:
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.
* 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)
unsigned int c;
nd->flags |= LOOKUP_CONTINUE;
- if (nd->flags & LOOKUP_RCU) {
- err = exec_permission(nd->inode, IPERM_FLAG_RCU);
- if (err == -ECHILD) {
- if (nameidata_drop_rcu(nd))
- return -ECHILD;
- goto exec_again;
- }
- } else {
-exec_again:
- err = exec_permission(nd->inode, 0);
- }
+
+ err = may_lookup(nd);
if (err)
break;