summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2011-03-16 09:45:02 +0300
committerAl Viro <viro@zeniv.linux.org.uk>2011-03-16 11:57:03 +0300
commit0e794589e588a88d34e339feee50c72606fb21a7 (patch)
tree74c193941b49c0c3bfe3e0934aaf4bbdff22eab4 /fs
parentd10902812c9cd5583130a4ebb9ad19c60b68149d (diff)
downloadlinux-0e794589e588a88d34e339feee50c72606fb21a7.tar.xz
fix follow_link() breakage
commit 574197e0de46a8a4db5c54ef7b65e43ffa8873a7 had a missing piece, breaking the loop detection ;-/ Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs')
-rw-r--r--fs/namei.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/fs/namei.c b/fs/namei.c
index 0a601cae23de..b912b7abe747 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -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 */