diff options
author | Alexei Starovoitov <ast@kernel.org> | 2017-12-25 13:15:42 -0800 |
---|---|---|
committer | Daniel Borkmann <daniel@iogearbox.net> | 2017-12-27 18:36:23 +0100 |
commit | aada9ce644e53410954daa6beb1f7c4ca158abd7 (patch) | |
tree | 6b20b371d1cb00f74dc0a298bc882d1c9acbd3f1 /kernel/bpf/verifier.c | |
parent | 6b86c4217c231cbd268bd8c6fda025b27047d3ed (diff) | |
download | blackbird-obmc-linux-aada9ce644e53410954daa6beb1f7c4ca158abd7.tar.gz blackbird-obmc-linux-aada9ce644e53410954daa6beb1f7c4ca158abd7.zip |
bpf: fix max call depth check
fix off by one error in max call depth check
and add a test
Fixes: f4d7e40a5b71 ("bpf: introduce function calls (verification)")
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Diffstat (limited to 'kernel/bpf/verifier.c')
-rw-r--r-- | kernel/bpf/verifier.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c index 738e919efdf0..52ad60b3b8be 100644 --- a/kernel/bpf/verifier.c +++ b/kernel/bpf/verifier.c @@ -2126,9 +2126,9 @@ static int check_func_call(struct bpf_verifier_env *env, struct bpf_insn *insn, struct bpf_func_state *caller, *callee; int i, subprog, target_insn; - if (state->curframe >= MAX_CALL_FRAMES) { + if (state->curframe + 1 >= MAX_CALL_FRAMES) { verbose(env, "the call stack of %d frames is too deep\n", - state->curframe); + state->curframe + 2); return -E2BIG; } |