]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
namei: take O_NOFOLLOW treatment into do_last()
authorAl Viro <viro@zeniv.linux.org.uk>
Wed, 22 Apr 2015 15:27:43 +0000 (11:27 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Mon, 11 May 2015 02:18:30 +0000 (22:18 -0400)
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/namei.c

index a77f9ca2c3e75071e86eed62ed6072e860b464b0..4c1a8bf917e455543df5618895432fe2377d3326 100644 (file)
@@ -3059,6 +3059,11 @@ finish_lookup:
                        }
                }
                BUG_ON(inode != path->dentry->d_inode);
+               if (!(nd->flags & LOOKUP_FOLLOW)) {
+                       path_put_conditional(path, nd);
+                       path_put(&nd->path);
+                       return -ELOOP;
+               }
                return 1;
        }
 
@@ -3243,12 +3248,6 @@ static struct file *path_openat(int dfd, struct filename *pathname,
        while (unlikely(error > 0)) { /* trailing symlink */
                struct path link = path;
                void *cookie;
-               if (!(nd->flags & LOOKUP_FOLLOW)) {
-                       path_put_conditional(&path, nd);
-                       path_put(&nd->path);
-                       error = -ELOOP;
-                       break;
-               }
                error = may_follow_link(&link, nd);
                if (unlikely(error))
                        break;