Skip to content

Commit ed7768d

Browse files
shardulsb08Kernel Patches Daemon
authored andcommitted
bpf: liveness: Handle ERR_PTR from get_outer_instance() in propagate_to_outer_instance()
propagate_to_outer_instance() calls get_outer_instance() and then uses the returned pointer to reset/commit stack write marks. When get_outer_instance() fails (e.g., __lookup_instance() returns -ENOMEM), it may return an ERR_PTR. Without a check, the code dereferences this error pointer. Protect the call with IS_ERR() and propagate the error. Reported-by: kernel-patches-review-bot (kernel-patches/bpf#10006 (comment)) Signed-off-by: Shardul Bankar <[email protected]> v2: Drop Fixes tag per Eduard’s review (not a functional bug).
1 parent d564564 commit ed7768d

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

kernel/bpf/liveness.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -524,6 +524,8 @@ static int propagate_to_outer_instance(struct bpf_verifier_env *env,
524524

525525
this_subprog_start = callchain_subprog_start(callchain);
526526
outer_instance = get_outer_instance(env, instance);
527+
if (IS_ERR(outer_instance))
528+
return PTR_ERR(outer_instance);
527529
callsite = callchain->callsites[callchain->curframe - 1];
528530

529531
reset_stack_write_marks(env, outer_instance, callsite);

0 commit comments

Comments
 (0)