current->link_count++;
current->total_link_count++;
nd->depth++;
+ if (path->mnt != nd->mnt)
+ mntput(nd->mnt);
err = __do_follow_link(path, nd);
current->link_count--;
nd->depth--;
return err;
loop:
+ if (path->mnt != nd->mnt)
+ mntput(nd->mnt);
dput(path->dentry);
path_release(nd);
return err;
break;
/* Check mountpoints.. */
__follow_mount(&next);
- if (nd->mnt != next.mnt)
- mntput(nd->mnt);
err = -ENOENT;
inode = next.dentry->d_inode;
break;
} else {
dput(nd->dentry);
+ if (nd->mnt != next.mnt)
+ mntput(nd->mnt);
nd->mnt = next.mnt;
nd->dentry = next.dentry;
}
if (err)
break;
__follow_mount(&next);
- if (nd->mnt != next.mnt)
- mntput(nd->mnt);
inode = next.dentry->d_inode;
if ((lookup_flags & LOOKUP_FOLLOW)
&& inode && inode->i_op && inode->i_op->follow_link) {
inode = nd->dentry->d_inode;
} else {
dput(nd->dentry);
+ if (nd->mnt != next.mnt)
+ mntput(nd->mnt);
nd->mnt = next.mnt;
nd->dentry = next.dentry;
}
return 0;
out_dput:
dput(next.dentry);
+ if (nd->mnt != next.mnt)
+ mntput(nd->mnt);
break;
}
path_release(nd);
if (__follow_mount(&path)) {
error = -ELOOP;
- if (flag & O_NOFOLLOW) {
- dput(path.dentry);
- mntput(path.mnt);
- goto exit;
- }
- mntput(nd->mnt);
- nd->mnt = path.mnt;
+ if (flag & O_NOFOLLOW)
+ goto exit_dput;
}
error = -ENOENT;
if (!path.dentry->d_inode)
dput(nd->dentry);
nd->dentry = path.dentry;
+ if (nd->mnt != path.mnt)
+ mntput(nd->mnt);
+ nd->mnt = path.mnt;
error = -EISDIR;
if (path.dentry->d_inode && S_ISDIR(path.dentry->d_inode->i_mode))
goto exit;
exit_dput:
dput(path.dentry);
+ if (nd->mnt != path.mnt)
+ mntput(path.mnt);
exit:
path_release(nd);
return error;
error = security_inode_follow_link(path.dentry, nd);
if (error)
goto exit_dput;
+ if (nd->mnt != path.mnt)
+ mntput(nd->mnt);
+ nd->mnt = path.mnt;
error = __do_follow_link(&path, nd);
if (error)
return error;