diff options
| author | Peter Zijlstra <peterz@infradead.org> | 2020-05-19 20:34:12 +0200 |
|---|---|---|
| committer | Peter Zijlstra <peterz@infradead.org> | 2020-05-19 20:34:12 +0200 |
| commit | 9013196a467e770e1470cccee6c0fe435ef37c66 (patch) | |
| tree | 2aefbb9d14a1a7513af9e752fe5bb80cf6b00c0c /kernel/bpf/arraymap.c | |
| parent | sched: Make scheduler_ipi inline (diff) | |
| parent | sched/fair: Fix unthrottle_cfs_rq() for leaf_cfs_rq list (diff) | |
| download | linux-9013196a467e770e1470cccee6c0fe435ef37c66.tar.gz linux-9013196a467e770e1470cccee6c0fe435ef37c66.zip | |
Merge branch 'sched/urgent'
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 = { |
