]> git.baikalelectronics.ru Git - kernel.git/commitdiff
bpf: Fix an error code in check_btf_func()
authorDan Carpenter <dan.carpenter@oracle.com>
Thu, 4 Jun 2020 08:54:36 +0000 (11:54 +0300)
committerDaniel Borkmann <daniel@iogearbox.net>
Thu, 4 Jun 2020 21:38:54 +0000 (23:38 +0200)
This code returns success if the "info_aux" allocation fails but it
should return -ENOMEM.

Fixes: c1d97dc5ef0d ("bpf: Compare BTF types of functions arguments with actual types")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Song Liu <songliubraving@fb.com>
Link: https://lore.kernel.org/bpf/20200604085436.GA943001@mwanda
kernel/bpf/verifier.c

index 5c7bbaac81ef951c840fec66e69ef53d11b8ad31..34cde841ab6819ebc61f992b38a61b66228ce8fb 100644 (file)
@@ -7552,7 +7552,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)