diff options
| author | 2020-06-08 10:14:49 -0700 | |
|---|---|---|
| committer | 2020-06-08 10:14:49 -0700 | |
| commit | 4263eb6880df8383fff0efb872278a99eb6142c8 (patch) | |
| tree | 67ab9bf228e4f5f341f9408e055180932b39fe06 /kernel/bpf/arraymap.c | |
| parent | bus: ti-sysc: Increase max softreset wait (diff) | |
| parent | ARM: dts: dra7-evm-common: Fix duplicate mailbox nodes (diff) | |
Merge branch 'fixes-v5.7' into fixes
Diffstat (limited to 'kernel/bpf/arraymap.c')
| -rw-r--r-- | kernel/bpf/arraymap.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/kernel/bpf/arraymap.c b/kernel/bpf/arraymap.c index 95d77770353c..1d6120fd5ba6 100644 --- a/kernel/bpf/arraymap.c +++ b/kernel/bpf/arraymap.c @@ -486,7 +486,12 @@ static int array_map_mmap(struct bpf_map *map, struct vm_area_struct *vma) if (!(map->map_flags & BPF_F_MMAPABLE)) return -EINVAL; - return remap_vmalloc_range(vma, array_map_vmalloc_addr(array), pgoff); + if (vma->vm_pgoff * PAGE_SIZE + (vma->vm_end - vma->vm_start) > + PAGE_ALIGN((u64)array->map.max_entries * array->elem_size)) + return -EINVAL; + + return remap_vmalloc_range(vma, array_map_vmalloc_addr(array), + vma->vm_pgoff + pgoff); } const struct bpf_map_ops array_map_ops = { |
