diff options
author | Kumar Kartikeya Dwivedi <memxor@gmail.com> | 2022-11-18 04:55:51 +0300 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2022-11-18 06:11:31 +0300 |
commit | c237bfa5283a562cd5d74dd74b2d9016acd97f45 (patch) | |
tree | 5e252f4eb40b2c1056cc7c6e3f63802979e84c31 /kernel | |
parent | 98b2afc8a67f651ed01fc7d5a7e2528e63dd4e08 (diff) | |
download | linux-c237bfa5283a562cd5d74dd74b2d9016acd97f45.tar.xz |
bpf: Fix early return in map_check_btf
Instead of returning directly with -EOPNOTSUPP for the timer case, we
need to free the btf_record before returning to userspace.
Fixes: db559117828d ("bpf: Consolidate spin_lock, timer management into btf_record")
Reported-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Link: https://lore.kernel.org/r/20221118015614.2013203-2-memxor@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/bpf/syscall.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c index b078965999e6..8eff51a63af6 100644 --- a/kernel/bpf/syscall.c +++ b/kernel/bpf/syscall.c @@ -1010,7 +1010,7 @@ static int map_check_btf(struct bpf_map *map, const struct btf *btf, if (map->map_type != BPF_MAP_TYPE_HASH && map->map_type != BPF_MAP_TYPE_LRU_HASH && map->map_type != BPF_MAP_TYPE_ARRAY) { - return -EOPNOTSUPP; + ret = -EOPNOTSUPP; goto free_map_tab; } break; |