Skip to content

Commit 8784714

Browse files
kkdwivediAlexei Starovoitov
authored andcommitted
bpf: Handle allocation failure in acquire_lock_state
The acquire_lock_state function needs to handle possible NULL values returned by acquire_reference_state, and return -ENOMEM. Fixes: 769b0f1 ("bpf: Refactor {acquire,release}_reference_state") Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com> Link: https://lore.kernel.org/r/20250206105435.2159977-24-memxor@gmail.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
1 parent 310794c commit 8784714

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

kernel/bpf/verifier.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1501,6 +1501,8 @@ static int acquire_lock_state(struct bpf_verifier_env *env, int insn_idx, enum r
15011501
struct bpf_reference_state *s;
15021502

15031503
s = acquire_reference_state(env, insn_idx);
1504+
if (!s)
1505+
return -ENOMEM;
15041506
s->type = type;
15051507
s->id = id;
15061508
s->ptr = ptr;

0 commit comments

Comments
 (0)