mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-15 02:05:33 +00:00
bpf: Fix range_tree_set() error handling
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>
This commit is contained in:
parent
bab18c7db4
commit
b8b1e30016
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user