Skip to content

Commit 13ddbf3

Browse files
committed
bpf: Avoid extra bpf_prog_ksym_find in bpf_stack_walker
Just like previous patch, call bpf_prog_ksym_find once, which lets us know the prog pointer and as a consequence also test whether we have a BPF program IP. Signed-off-by: Kumar Kartikeya Dwivedi <[email protected]>
1 parent ef67a60 commit 13ddbf3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

kernel/bpf/helpers.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2934,11 +2934,11 @@ static bool bpf_stack_walker(void *cookie, u64 ip, u64 sp, u64 bp)
29342934
struct bpf_throw_ctx *ctx = cookie;
29352935
struct bpf_prog *prog;
29362936

2937-
if (!is_bpf_text_address(ip))
2938-
return !ctx->cnt;
29392937
rcu_read_lock();
29402938
prog = bpf_prog_ksym_find(ip);
29412939
rcu_read_unlock();
2940+
if (!prog)
2941+
return !ctx->cnt;
29422942
ctx->cnt++;
29432943
if (bpf_is_subprog(prog))
29442944
return true;

0 commit comments

Comments
 (0)