fix follow_link() breakage
authorAl Viro <viro@zeniv.linux.org.uk>
Wed, 16 Mar 2011 06:45:02 +0000 (02:45 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Wed, 16 Mar 2011 08:57:03 +0000 (04:57 -0400)
commit 574197e0de46a8a4db5c54ef7b65e43ffa8873a7 had a missing
piece, breaking the loop detection ;-/

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/namei.c

index 0a601cae23ded383e2b2c0e7296705fa8579d68a..b912b7abe747b02e1bae5955a86598d8b727bdc4 100644 (file)
@@ -753,9 +753,11 @@ follow_link(struct path *link, struct nameidata *nd, void **p)
 
        BUG_ON(nd->flags & LOOKUP_RCU);
 
+       if (link->mnt == nd->path.mnt)
+               mntget(link->mnt);
+
        if (unlikely(current->total_link_count >= 40)) {
                *p = ERR_PTR(-ELOOP); /* no ->put_link(), please */
-               path_put_conditional(link, nd);
                path_put(&nd->path);
                return -ELOOP;
        }
@@ -765,9 +767,6 @@ follow_link(struct path *link, struct nameidata *nd, void **p)
        touch_atime(link->mnt, dentry);
        nd_set_link(nd, NULL);
 
-       if (link->mnt == nd->path.mnt)
-               mntget(link->mnt);
-
        error = security_inode_follow_link(link->dentry, nd);
        if (error) {
                *p = ERR_PTR(error); /* no ->put_link(), please */