diff mbox series

path_pts: missing check for d_hash_and_lookup()

Message ID 9c28c58f-f90c-fe61-66ed-14dbb03088e7@virtuozzo.com (mailing list archive)
State New, archived
Headers show
Series path_pts: missing check for d_hash_and_lookup() | expand

Commit Message

Vasily Averin June 7, 2020, 3 p.m. UTC
Parent dentry can be located on any file system
therefore d_hash_and_lookup() can return ERR_PTR

Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
---
 fs/namei.c | 2 ++
 1 file changed, 2 insertions(+)
diff mbox series

Patch

diff --git a/fs/namei.c b/fs/namei.c
index a320371899cf..6c97599f307b 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -2616,6 +2616,8 @@  int path_pts(struct path *path)
 	dput(path->dentry);
 	path->dentry = parent;
 	child = d_hash_and_lookup(parent, &this);
+	if (IS_ERR(child))
+		return PTR_ERR(child);
 	if (!child)
 		return -ENOENT;