From: Dan Carpenter <dan.carpen...@oracle.com>

[ Upstream commit e7ed83d6fa1a00d0f2ad0327e73d3ea9e7ea8de1 ]

This code returns success if the "info_aux" allocation fails but it
should return -ENOMEM.

Fixes: 8c1b6e69dcc1 ("bpf: Compare BTF types of functions arguments with actual 
types")
Signed-off-by: Dan Carpenter <dan.carpen...@oracle.com>
Signed-off-by: Daniel Borkmann <dan...@iogearbox.net>
Acked-by: Song Liu <songliubrav...@fb.com>
Link: https://lore.kernel.org/bpf/20200604085436.GA943001@mwanda
Signed-off-by: Sasha Levin <sas...@kernel.org>
---
 kernel/bpf/verifier.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
index efe14cf24bc65..739d9ba3ba6b7 100644
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -7366,7 +7366,7 @@ static int check_btf_func(struct bpf_verifier_env *env,
        const struct btf *btf;
        void __user *urecord;
        u32 prev_offset = 0;
-       int ret = 0;
+       int ret = -ENOMEM;
 
        nfuncs = attr->func_info_cnt;
        if (!nfuncs)
-- 
2.25.1



Reply via email to