Commit ef9f43d5 authored by Russell King's avatar Russell King

[ARM] Ensure we do not remap pages outside the allocated range.

parent 530f890b
...@@ -286,7 +286,7 @@ static int dma_mmap(struct device *dev, struct vm_area_struct *vma, ...@@ -286,7 +286,7 @@ static int dma_mmap(struct device *dev, struct vm_area_struct *vma,
if (c) { if (c) {
kern_size = (c->vm_end - c->vm_start) >> PAGE_SHIFT; kern_size = (c->vm_end - c->vm_start) >> PAGE_SHIFT;
if (vma->vm_pgoff < kern_size || if (vma->vm_pgoff < kern_size &&
user_size <= (kern_size - vma->vm_pgoff)) { user_size <= (kern_size - vma->vm_pgoff)) {
vma->vm_flags |= VM_RESERVED; vma->vm_flags |= VM_RESERVED;
ret = remap_pfn_range(vma, vma->vm_start, ret = remap_pfn_range(vma, vma->vm_start,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment