aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/bpf/arraymap.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/bpf/arraymap.c')
-rw-r--r--kernel/bpf/arraymap.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/kernel/bpf/arraymap.c b/kernel/bpf/arraymap.c
index 1a6e9861d554..217b10bd9f48 100644
--- a/kernel/bpf/arraymap.c
+++ b/kernel/bpf/arraymap.c
@@ -22,7 +22,7 @@
22#include "map_in_map.h" 22#include "map_in_map.h"
23 23
24#define ARRAY_CREATE_FLAG_MASK \ 24#define ARRAY_CREATE_FLAG_MASK \
25 (BPF_F_NUMA_NODE | BPF_F_RDONLY | BPF_F_WRONLY) 25 (BPF_F_NUMA_NODE | BPF_F_ACCESS_MASK)
26 26
27static void bpf_array_free_percpu(struct bpf_array *array) 27static void bpf_array_free_percpu(struct bpf_array *array)
28{ 28{
@@ -63,6 +63,7 @@ int array_map_alloc_check(union bpf_attr *attr)
63 if (attr->max_entries == 0 || attr->key_size != 4 || 63 if (attr->max_entries == 0 || attr->key_size != 4 ||
64 attr->value_size == 0 || 64 attr->value_size == 0 ||
65 attr->map_flags & ~ARRAY_CREATE_FLAG_MASK || 65 attr->map_flags & ~ARRAY_CREATE_FLAG_MASK ||
66 !bpf_map_flags_access_ok(attr->map_flags) ||
66 (percpu && numa_node != NUMA_NO_NODE)) 67 (percpu && numa_node != NUMA_NO_NODE))
67 return -EINVAL; 68 return -EINVAL;
68 69
@@ -472,6 +473,9 @@ static int fd_array_map_alloc_check(union bpf_attr *attr)
472 /* only file descriptors can be stored in this type of map */ 473 /* only file descriptors can be stored in this type of map */
473 if (attr->value_size != sizeof(u32)) 474 if (attr->value_size != sizeof(u32))
474 return -EINVAL; 475 return -EINVAL;
476 /* Program read-only/write-only not supported for special maps yet. */
477 if (attr->map_flags & (BPF_F_RDONLY_PROG | BPF_F_WRONLY_PROG))
478 return -EINVAL;
475 return array_map_alloc_check(attr); 479 return array_map_alloc_check(attr);
476} 480}
477 481