Skip to content

Commit

Permalink
vfs: namei: use path_equal() in follow_dotdot()
Browse files Browse the repository at this point in the history
Use path_equal() to detect whether we're already in root.

Signed-off-by: Danilo Krummrich <[email protected]>
Signed-off-by: Al Viro <[email protected]>
  • Loading branch information
Danilo Krummrich authored and Al Viro committed May 18, 2018
1 parent 75abe32 commit 030c7e0
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions fs/namei.c
Original file line number Diff line number Diff line change
Expand Up @@ -1438,10 +1438,8 @@ static int path_parent_directory(struct path *path)
static int follow_dotdot(struct nameidata *nd)
{
while(1) {
if (nd->path.dentry == nd->root.dentry &&
nd->path.mnt == nd->root.mnt) {
if (path_equal(&nd->path, &nd->root))
break;
}
if (nd->path.dentry != nd->path.mnt->mnt_root) {
int ret = path_parent_directory(&nd->path);
if (ret)
Expand Down

0 comments on commit 030c7e0

Please sign in to comment.