diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c index 0806295945e4..6aa303f76849 100644 --- a/kernel/bpf/verifier.c +++ b/kernel/bpf/verifier.c @@ -11344,6 +11344,13 @@ static bool can_elide_value_nullness(enum bpf_map_type type) } } +static bool is_valid_proto(const struct bpf_func_proto *fn, int func_id) +{ + if (func_id == BPF_FUNC_tail_call) + return true; + return fn && fn->func; +} + static int get_helper_proto(struct bpf_verifier_env *env, int func_id, const struct bpf_func_proto **ptr) { @@ -11354,7 +11361,7 @@ static int get_helper_proto(struct bpf_verifier_env *env, int func_id, return -EINVAL; *ptr = env->ops->get_func_proto(func_id, env->prog); - return *ptr ? 0 : -EINVAL; + return is_valid_proto(*ptr, func_id) ? 0 : -EINVAL; } static int check_helper_call(struct bpf_verifier_env *env, struct bpf_insn *insn,