fs: orangefs: fix error return code of orangefs_revalidate_lookup()
authorJia-Ju Bai <baijiaju1990@gmail.com>
Tue, 9 Mar 2021 08:00:20 +0000 (00:00 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 26 Nov 2021 10:48:38 +0000 (11:48 +0100)
[ Upstream commit 4c2b46c824a78fc8190d8eafaaea5a9078fe7479 ]

When op_alloc() returns NULL to new_op, no error return code of
orangefs_revalidate_lookup() is assigned.
To fix this bug, ret is assigned with -ENOMEM in this case.

Fixes: 8bb8aefd5afb ("OrangeFS: Change almost all instances of the string PVFS2 to OrangeFS.")
Reported-by: TOTE Robot <oslab@tsinghua.edu.cn>
Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
Signed-off-by: Mike Marshall <hubcap@omnibond.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/orangefs/dcache.c

index 5355efba4bc8c13f4e2ac2f5a7dfe7a6a6284225..1942f9946ab776cd7e0993b122eeb5eb18f3d6d9 100644 (file)
@@ -25,8 +25,10 @@ static int orangefs_revalidate_lookup(struct dentry *dentry)
        gossip_debug(GOSSIP_DCACHE_DEBUG, "%s: attempting lookup.\n", __func__);
 
        new_op = op_alloc(ORANGEFS_VFS_OP_LOOKUP);
-       if (!new_op)
+       if (!new_op) {
+               ret = -ENOMEM;
                goto out_put_parent;
+       }
 
        new_op->upcall.req.lookup.sym_follow = ORANGEFS_LOOKUP_LINK_NO_FOLLOW;
        new_op->upcall.req.lookup.parent_refn = parent->refn;