mirror of
https://github.com/torvalds/linux.git
synced 2026-05-25 15:41:52 +02:00
bpf: Do not increment tailcall count when prog is NULL
Currently, tailcall count is incremented in the interpreter even when tailcall fails due to non-existent prog. Fix this by holding off on the tailcall count increment until after NULL check on the prog. Suggested-by: Ilya Leoshkevich <iii@linux.ibm.com> Signed-off-by: Hari Bathini <hbathini@linux.ibm.com> Link: https://lore.kernel.org/r/20260220062959.195101-1-hbathini@linux.ibm.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
This commit is contained in:
parent
055d8dd553
commit
3733f4be28
|
|
@ -2060,12 +2060,12 @@ static u64 ___bpf_prog_run(u64 *regs, const struct bpf_insn *insn)
|
|||
if (unlikely(tail_call_cnt >= MAX_TAIL_CALL_CNT))
|
||||
goto out;
|
||||
|
||||
tail_call_cnt++;
|
||||
|
||||
prog = READ_ONCE(array->ptrs[index]);
|
||||
if (!prog)
|
||||
goto out;
|
||||
|
||||
tail_call_cnt++;
|
||||
|
||||
/* ARG1 at this point is guaranteed to point to CTX from
|
||||
* the verifier side due to the fact that the tail call is
|
||||
* handled like a helper, that is, bpf_tail_call_proto,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user