bpf: Add missing map_get_next_key method to bloom filter map
PATCH v2 1/1 bpf: Add missing map_get_next_key method to bloom filter map
From: Haimin Zhang <[email protected]>
Without it, kernel crashes in map_get_next_key().
Fixes 9330986c0300 ("bpf: Add bloom filter map implementation")
Reported-by TCS Robot <[email protected]>
Signed-off-by Haimin Zhang <[email protected]>
Signed-off-by Daniel Borkmann <[email protected]>
--- kernel/bpf/bloom_filter.c | 6 ++++++ 1 file changed, 6 insertions(+)
kernel/bpf/bloom_filter.c +6 -0
@@ -82,6 +82,11 @@ static int bloom_map_delete_elem(struct bpf_map *map, void *value)return -EOPNOTSUPP ; } +static int bloom_map_get_next_key (struct bpf_map *map,void *key,void *next_key) +{ +return -EOPNOTSUPP ; +} +static struct bpf_map *bloom_map_alloc (union bpf_attr *attr) {u32 bitset_bytes, bitset_mask, nr_hash_funcs, nr_bits;
@@ -192,6 +197,7 @@ const struct bpf_map_ops bloom_filter_map_ops = { .map_meta_equal = bpf_map_meta_equal, .map_alloc = bloom_map_alloc, .map_free = bloom_map_free, + .map_get_next_key = bloom_map_get_next_key, .map_push_elem = bloom_map_push_elem, .map_peek_elem = bloom_map_peek_elem, .map_pop_elem = bloom_map_pop_elem,
Signature · 1 line
2.27.0
Quoted 10 lines · On 12/29/21 3:20 AM, [email protected] wrote:
From: Haimin Zhang <[email protected]>
Without it, kernel crashes in
map_get_next_key().Fixes 9330986c0300 ("bpf: Add bloom filter map implementation")Reported-by TCS Robot <[email protected]>Signed-off-by Haimin Zhang <[email protected]>Signed-off-by Daniel Borkmann <[email protected]>---
Thanks for fixing this. I'll take a look at the other bpf_map_ops and see if there are other missing ones.
Acked-by Joanne Koong <[email protected]>
Quoted 27 lines
kernel/bpf/bloom_filter.c | 6 ++++++ 1 file changed, 6 insertions(+)kernel/bpf/bloom_filter.c +6
-0@@ -82,6 +82,11 @@ static int bloom_map_delete_elem(struct bpf_map *map, void *value)return -EOPNOTSUPP ; } +static int bloom_map_get_next_key (struct bpf_map *map,void *key,void *next_key) +{ +return -EOPNOTSUPP ; +} +static struct bpf_map *bloom_map_alloc (union bpf_attr *attr) {u32 bitset_bytes, bitset_mask, nr_hash_funcs, nr_bits;@@ -192,6 +197,7 @@ const struct bpf_map_ops bloom_filter_map_ops = { .map_meta_equal = bpf_map_meta_equal, .map_alloc = bloom_map_alloc, .map_free = bloom_map_free, + .map_get_next_key = bloom_map_get_next_key, .map_push_elem = bloom_map_push_elem, .map_peek_elem = bloom_map_peek_elem, .map_pop_elem = bloom_map_pop_elem,
Quoted 5 lines · Joanne Koong
Quoted 2 lines · On 12/29/21 3:20 AM, [email protected] wrote:
From: Haimin Zhang <[email protected]>
Quoted 7 lines
Quoted 7 lines
Without it, kernel crashes in
map_get_next_key().Fixes 9330986c0300 ("bpf: Add bloom filter map implementation")Reported-by TCS Robot <[email protected]>Signed-off-by Haimin Zhang <[email protected]>Signed-off-by Daniel Borkmann <[email protected]>
Haimin,
Daniel didn't give you his SOB in v1 patch, so I've dropped it while applying.
Quoted 6 lines
Quoted 1 line
---
Thanks for fixing this. I'll take a look at the other
bpf_map_opsand see if there are other missing ones.Acked-by Joanne Koong <[email protected]>
Thanks everyone.