projects
/
openwrt
/
staging
/
blogic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
301f935
)
samples: bpf: ensure that we don't load over MAX_PROGS programs
author
Dan Carpenter
<dan.carpenter@oracle.com>
Fri, 13 Jul 2018 15:11:39 +0000
(18:11 +0300)
committer
Alexei Starovoitov
<ast@kernel.org>
Mon, 16 Jul 2018 22:00:56 +0000
(15:00 -0700)
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>
samples/bpf/bpf_load.c
patch
|
blob
|
history
diff --git
a/samples/bpf/bpf_load.c
b/samples/bpf/bpf_load.c
index 89161c9ed466b63bda3b25b275559bf0892d2fee..904e775d1a44c5f9cd0582bf4db8af4b3b0a011a 100644
(file)
--- a/
samples/bpf/bpf_load.c
+++ b/
samples/bpf/bpf_load.c
@@
-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) {