bpf: fix max call depth check
fix off by one error in max call depth check
and add a test
Fixes: f4d7e40a5b
("bpf: introduce function calls (verification)")
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
This commit is contained in:
committed by
Daniel Borkmann
parent
6b86c4217c
commit
aada9ce644
@ -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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user