VisionFive2 Linux kernel

StarFive Tech Linux Kernel for VisionFive (JH7110) boards (mirror)

More than 9999 Commits   33 Branches   57 Tags
author: Bixuan Cui <cuibixuan@huawei.com> 2021-09-11 08:55:57 +0800 committer: Alexei Starovoitov <ast@kernel.org> 2021-09-13 16:28:15 -0700 commit: 0e6491b559704da720f6da09dd0a52c4df44c514 parent: 2f1aaf3ea666b737ad717b3d88667225aca23149
Commit Summary:
bpf: Add oversize check before call kvcalloc()
Diffstat:
1 file changed, 2 insertions, 0 deletions
diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
index 047ac4b4703b..e76b55917905 100644
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -9912,6 +9912,8 @@ static int check_btf_line(struct bpf_verifier_env *env,
 	nr_linfo = attr->line_info_cnt;
 	if (!nr_linfo)
 		return 0;
+	if (nr_linfo > INT_MAX / sizeof(struct bpf_line_info))
+		return -EINVAL;
 
 	rec_size = attr->line_info_rec_size;
 	if (rec_size < MIN_BPF_LINEINFO_SIZE ||