Skip to content

Commit

Permalink
fix follow_link() breakage
Browse files Browse the repository at this point in the history
commit 574197e had a missing
piece, breaking the loop detection ;-/

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
  • Loading branch information
Al Viro committed Mar 16, 2011
1 parent d109028 commit 0e79458
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions fs/namei.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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 */
Expand Down

0 comments on commit 0e79458

Please sign in to comment.