Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>

authored by

Dan Carpenter and committed by
Alexei Starovoitov
b0294bc1 301f935b

+3
+3
samples/bpf/bpf_load.c
··· 107 107 return -1; 108 108 } 109 109 110 + if (prog_cnt == MAX_PROGS) 111 + return -1; 112 + 110 113 fd = bpf_load_program(prog_type, prog, insns_cnt, license, kern_version, 111 114 bpf_log_buf, BPF_LOG_BUF_SIZE); 112 115 if (fd < 0) {