1
0
Fork 0

fix follow_link() breakage

commit 574197e0de had a missing
piece, breaking the loop detection ;-/

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
hifive-unleashed-5.1
Al Viro 2011-03-16 02:45:02 -04:00
parent d10902812c
commit 0e794589e5
1 changed files with 3 additions and 4 deletions

View 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 */