Skip to contentSkip to conversation

bpf: Add missing map_get_next_key method to bloom filter map

PATCH In review [email protected] 3 participants 3 messages Dec 29, 2021 BPF

lore
Share & tools
lore
#0 lore raw

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")
---
 kernel/bpf/bloom_filter.c | 6 ++++++
 1 file changed, 6 insertions(+)
kernel/bpf/bloom_filter.c +6 -0
index 277a05e9c984..fa34dc871995 100644
@@ -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
Acked-by on v2 1/1
#1 lore raw
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")

---

Thanks for fixing this. I'll take a look at the other bpf_map_ops and see if there are other missing ones.

Quoted 27 lines
  kernel/bpf/bloom_filter.c | 6 ++++++
  1 file changed, 6 insertions(+)
kernel/bpf/bloom_filter.c +6 -0
index 277a05e9c984..fa34dc871995 100644
@@ -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,
#2 lore raw
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")

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_ops and see if there are other missing ones.

Thanks everyone.