diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c index cd3c1a11fef1690b5ca0826cd20762f3b7933d26..e9b6e50a6764699f79951352e08986a837d1fe47 100644 --- a/kernel/bpf/btf.c +++ b/kernel/bpf/btf.c @@ -4700,6 +4700,11 @@ bool btf_ctx_access(int off, int size, enum bpf_access_type type, const struct bpf_ctx_arg_aux *ctx_arg_info = &prog->aux->ctx_arg_info[i]; if (ctx_arg_info->offset == off) { + if (!ctx_arg_info->btf_id) { + bpf_log(log,"invalid btf_id for context argument offset %u\n", off); + return false; + } + info->reg_type = ctx_arg_info->reg_type; info->btf = btf_vmlinux; info->btf_id = ctx_arg_info->btf_id;