diff options
author | Kumar Kartikeya Dwivedi <memxor@gmail.com> | 2025-02-06 02:54:31 -0800 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2025-02-07 18:17:07 -0800 |
commit | 8784714d7f27045c7cb72456cf66705b73fbc804 (patch) | |
tree | 2dc69f046f163a4579e036ed4689b34b3bab3a98 | |
parent | 310794c219e7b6bd4b21254ac3b871ee989cbece (diff) |
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: 769b0f1c8214 ("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>
-rw-r--r-- | kernel/bpf/verifier.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c index 98354d781678..60611df77957 100644 --- a/kernel/bpf/verifier.c +++ b/kernel/bpf/verifier.c @@ -1501,6 +1501,8 @@ static int acquire_lock_state(struct bpf_verifier_env *env, int insn_idx, enum r struct bpf_reference_state *s; s = acquire_reference_state(env, insn_idx); + if (!s) + return -ENOMEM; s->type = type; s->id = id; s->ptr = ptr; |