vfs: namei: use path_equal() in follow_dotdot()

Use path_equal() to detect whether we're already in root.

Signed-off-by: Danilo Krummrich <danilokrummrich@dk-develop.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
Danilo Krummrich 2018-04-23 10:30:59 +02:00 committed by Al Viro
parent 75abe32946
commit 030c7e0bb7
1 changed files with 1 additions and 3 deletions

View File

@ -1438,10 +1438,8 @@ static int path_parent_directory(struct path *path)
static int follow_dotdot(struct nameidata *nd) static int follow_dotdot(struct nameidata *nd)
{ {
while(1) { while(1) {
if (nd->path.dentry == nd->root.dentry && if (path_equal(&nd->path, &nd->root))
nd->path.mnt == nd->root.mnt) {
break; break;
}
if (nd->path.dentry != nd->path.mnt->mnt_root) { if (nd->path.dentry != nd->path.mnt->mnt_root) {
int ret = path_parent_directory(&nd->path); int ret = path_parent_directory(&nd->path);
if (ret) if (ret)