提交 b0294bc1 编写于 作者: D Dan Carpenter 提交者: Alexei Starovoitov

samples: bpf: ensure that we don't load over MAX_PROGS programs

I can't see that we check prog_cnt to ensure it doesn't go over
MAX_PROGS.
Signed-off-by: NDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: NAlexei Starovoitov <ast@kernel.org>
上级 301f935b
......@@ -107,6 +107,9 @@ static int load_and_attach(const char *event, struct bpf_insn *prog, int size)
return -1;
}
if (prog_cnt == MAX_PROGS)
return -1;
fd = bpf_load_program(prog_type, prog, insns_cnt, license, kern_version,
bpf_log_buf, BPF_LOG_BUF_SIZE);
if (fd < 0) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册