projects
/
linux-block.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
bab18c7
)
bpf: Fix range_tree_set() error handling
author
Soma Nakata
<soma.nakata@somane.sakura.ne.jp>
Mon, 6 Jan 2025 23:15:35 +0000
(08:15 +0900)
committer
Alexei Starovoitov
<ast@kernel.org>
Wed, 8 Jan 2025 17:35:33 +0000
(09:35 -0800)
range_tree_set() might fail and return -ENOMEM,
causing subsequent `bpf_arena_alloc_pages` to fail.
Add the error handling.
Signed-off-by: Soma Nakata <soma.nakata@somane.sakura.ne.jp>
Acked-by: Hou Tao <houtao1@huawei.com>
Link:
https://lore.kernel.org/r/20250106231536.52856-1-soma.nakata@somane.sakura.ne.jp
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
kernel/bpf/arena.c
patch
|
blob
|
blame
|
history
diff --git
a/kernel/bpf/arena.c
b/kernel/bpf/arena.c
index 41a76ca56040485ba43bcb452a535321db2025a9..4b22a651b5d55a2a189f24e8f1d53348051a1e2f 100644
(file)
--- a/
kernel/bpf/arena.c
+++ b/
kernel/bpf/arena.c
@@
-138,7
+138,11
@@
static struct bpf_map *arena_map_alloc(union bpf_attr *attr)
INIT_LIST_HEAD(&arena->vma_list);
bpf_map_init_from_attr(&arena->map, attr);
range_tree_init(&arena->rt);
- range_tree_set(&arena->rt, 0, attr->max_entries);
+ err = range_tree_set(&arena->rt, 0, attr->max_entries);
+ if (err) {
+ bpf_map_area_free(arena);
+ goto err;
+ }
mutex_init(&arena->lock);
return &arena->map;