diff options
author | Daniel Borkmann <daniel@iogearbox.net> | 2017-10-17 10:55:54 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-10-19 08:13:50 -0400 |
commit | bc6d5031b43a2291de638ab9304320b4cae61689 (patch) | |
tree | c67f4312dd0af8422b5400b0442583660535df12 /kernel/bpf/arraymap.c | |
parent | 82f8dd28bd3abe181b7a66ea4ea132134d37a400 (diff) |
bpf: do not test for PCPU_MIN_UNIT_SIZE before percpu allocations
PCPU_MIN_UNIT_SIZE is an implementation detail of the percpu
allocator. Given we support __GFP_NOWARN now, lets just let
the allocation request fail naturally instead. The two call
sites from BPF mistakenly assumed __GFP_NOWARN would work, so
no changes needed to their actual __alloc_percpu_gfp() calls
which use the flag already.
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: John Fastabend <john.fastabend@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'kernel/bpf/arraymap.c')
-rw-r--r-- | kernel/bpf/arraymap.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel/bpf/arraymap.c b/kernel/bpf/arraymap.c index 98c0f00c3f5e..e2636737b69b 100644 --- a/kernel/bpf/arraymap.c +++ b/kernel/bpf/arraymap.c | |||
@@ -98,7 +98,7 @@ static struct bpf_map *array_map_alloc(union bpf_attr *attr) | |||
98 | array_size += (u64) attr->max_entries * elem_size * num_possible_cpus(); | 98 | array_size += (u64) attr->max_entries * elem_size * num_possible_cpus(); |
99 | 99 | ||
100 | if (array_size >= U32_MAX - PAGE_SIZE || | 100 | if (array_size >= U32_MAX - PAGE_SIZE || |
101 | elem_size > PCPU_MIN_UNIT_SIZE || bpf_array_alloc_percpu(array)) { | 101 | bpf_array_alloc_percpu(array)) { |
102 | bpf_map_area_free(array); | 102 | bpf_map_area_free(array); |
103 | return ERR_PTR(-ENOMEM); | 103 | return ERR_PTR(-ENOMEM); |
104 | } | 104 | } |