diff --git a/fs/namei.c b/fs/namei.c index f7593c0899d1..91188604ffec 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -2109,7 +2109,7 @@ static struct file *do_last(struct nameidata *nd, struct path *path, /* sayonara */ error = complete_walk(nd); if (error) - return ERR_PTR(-ECHILD); + return ERR_PTR(error); error = -ENOTDIR; if (nd->flags & LOOKUP_DIRECTORY) {