Skip to content

Commit

Permalink
fs: Fix error checking for d_hash_and_lookup()
Browse files Browse the repository at this point in the history
[ Upstream commit 0d5a4f8 ]

The d_hash_and_lookup() function returns error pointers or NULL.
Most incorrect error checks were fixed, but the one in int path_pts()
was forgotten.

Fixes: eedf265 ("devpts: Make each mount of devpts an independent filesystem.")
Signed-off-by: Wang Ming <machel@vivo.com>
Message-Id: <20230713120555.7025-1-machel@vivo.com>
Signed-off-by: Christian Brauner <brauner@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Wang Ming authored and gregkh committed Sep 13, 2023
1 parent e12214c commit b553ac4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/namei.c
Expand Up @@ -2859,7 +2859,7 @@ int path_pts(struct path *path)
dput(path->dentry);
path->dentry = parent;
child = d_hash_and_lookup(parent, &this);
if (!child)
if (IS_ERR_OR_NULL(child))
return -ENOENT;

path->dentry = child;
Expand Down

0 comments on commit b553ac4

Please sign in to comment.