Commit 0e794589 authored by Al Viro's avatar Al Viro

fix follow_link() breakage

commit 574197e0 had a missing
piece, breaking the loop detection ;-/
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent d1090281
...@@ -753,9 +753,11 @@ follow_link(struct path *link, struct nameidata *nd, void **p) ...@@ -753,9 +753,11 @@ follow_link(struct path *link, struct nameidata *nd, void **p)
BUG_ON(nd->flags & LOOKUP_RCU); BUG_ON(nd->flags & LOOKUP_RCU);
if (link->mnt == nd->path.mnt)
mntget(link->mnt);
if (unlikely(current->total_link_count >= 40)) { if (unlikely(current->total_link_count >= 40)) {
*p = ERR_PTR(-ELOOP); /* no ->put_link(), please */ *p = ERR_PTR(-ELOOP); /* no ->put_link(), please */
path_put_conditional(link, nd);
path_put(&nd->path); path_put(&nd->path);
return -ELOOP; return -ELOOP;
} }
...@@ -765,9 +767,6 @@ follow_link(struct path *link, struct nameidata *nd, void **p) ...@@ -765,9 +767,6 @@ follow_link(struct path *link, struct nameidata *nd, void **p)
touch_atime(link->mnt, dentry); touch_atime(link->mnt, dentry);
nd_set_link(nd, NULL); nd_set_link(nd, NULL);
if (link->mnt == nd->path.mnt)
mntget(link->mnt);
error = security_inode_follow_link(link->dentry, nd); error = security_inode_follow_link(link->dentry, nd);
if (error) { if (error) {
*p = ERR_PTR(error); /* no ->put_link(), please */ *p = ERR_PTR(error); /* no ->put_link(), please */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment