diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c index 138f0302692ec4bfc1138075f69a858077221eb5..378cef70341c4e5b4b137bac7ed84aab75529af0 100644 --- a/kernel/bpf/btf.c +++ b/kernel/bpf/btf.c @@ -2114,6 +2114,9 @@ static int btf_parse_hdr(struct btf_verifier_env *env, void __user *btf_data, hdr = &btf->hdr; + if (hdr->hdr_len != hdr_len) + return -EINVAL; + btf_verifier_log_hdr(env, btf_data_size); if (hdr->magic != BTF_MAGIC) {