summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2011-03-04 20:28:10 +0100
committerAl Viro <viro@zeniv.linux.org.uk>2011-03-14 14:15:25 +0100
commit4455ca6223cc59cbc0a75f4be8bce9e84cc0d6b8 (patch)
tree5fb5966330b9dff9a364da07e85c224b89ca9dd2 /fs
parentpull handling of . and .. into inlined helper (diff)
downloadlinux-4455ca6223cc59cbc0a75f4be8bce9e84cc0d6b8.tar.xz
linux-4455ca6223cc59cbc0a75f4be8bce9e84cc0d6b8.zip
clear RCU on all failure exits from link_path_walk()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs')
-rw-r--r--fs/namei.c30
1 files changed, 16 insertions, 14 deletions
diff --git a/fs/namei.c b/fs/namei.c
index d29f91e8ff3d..f09887a45831 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -1405,8 +1405,9 @@ static int link_path_walk(const char *name, struct nameidata *nd)
* parent relationships.
*/
if (unlikely(type != LAST_NORM)) {
- if (handle_dots(nd, type))
- return -ECHILD;
+ err = handle_dots(nd, type);
+ if (err)
+ goto return_err;
continue;
}
@@ -1441,8 +1442,9 @@ last_component:
if (lookup_flags & LOOKUP_PARENT)
goto lookup_parent;
if (unlikely(type != LAST_NORM)) {
- if (handle_dots(nd, type))
- return -ECHILD;
+ err = handle_dots(nd, type);
+ if (err)
+ goto return_err;
return 0;
}
err = do_lookup(nd, &this, &next, &inode);
@@ -1475,6 +1477,12 @@ lookup_parent:
if (!(nd->flags & LOOKUP_RCU))
path_put(&nd->path);
return_err:
+ if (nd->flags & LOOKUP_RCU) {
+ nd->flags &= ~LOOKUP_RCU;
+ nd->root.mnt = NULL;
+ rcu_read_unlock();
+ br_read_unlock(vfsmount_lock);
+ }
return err;
}
@@ -1585,16 +1593,10 @@ static int path_lookupat(int dfd, const char *name,
retval = link_path_walk(name, nd);
if (nd->flags & LOOKUP_RCU) {
- /* RCU dangling. Cancel it. */
- if (!retval) {
- if (nameidata_drop_rcu_last(nd))
- retval = -ECHILD;
- } else {
- nd->flags &= ~LOOKUP_RCU;
- nd->root.mnt = NULL;
- rcu_read_unlock();
- br_read_unlock(vfsmount_lock);
- }
+ /* went all way through without dropping RCU */
+ BUG_ON(retval);
+ if (nameidata_drop_rcu_last(nd))
+ retval = -ECHILD;
}
if (!retval)