diff options
| author | Greg Kroah-Hartman <[email protected]> | 2020-05-25 09:11:19 +0200 |
|---|---|---|
| committer | Greg Kroah-Hartman <[email protected]> | 2020-05-25 09:11:19 +0200 |
| commit | c2312ff575fcaed96889d5bb5392afcc604c9442 (patch) | |
| tree | 475d63360ee17732fac41c7c1e4a1636ed92e7cb /kernel/bpf/arraymap.c | |
| parent | a3975dea1696b7c81319dc4b66e3c378dd47ccfb (diff) | |
| parent | 9cb1fd0efd195590b828b9b865421ad345a4a145 (diff) | |
Merge 5.7-rc7 into staging-next
We need the staging/iio fixes in here as well.
Signed-off-by: Greg Kroah-Hartman <[email protected]>
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 = { |