|
@@ -366,6 +366,12 @@ static int ashmem_mmap(struct file *file, struct vm_area_struct *vma)
|
|
goto out;
|
|
goto out;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /* requested mapping size larger than object size */
|
|
|
|
+ if (vma->vm_end - vma->vm_start > PAGE_ALIGN(asma->size)) {
|
|
|
|
+ ret = -EINVAL;
|
|
|
|
+ goto out;
|
|
|
|
+ }
|
|
|
|
+
|
|
/* requested protection bits must match our allowed protection mask */
|
|
/* requested protection bits must match our allowed protection mask */
|
|
if ((vma->vm_flags & ~calc_vm_prot_bits(asma->prot_mask, 0)) &
|
|
if ((vma->vm_flags & ~calc_vm_prot_bits(asma->prot_mask, 0)) &
|
|
calc_vm_prot_bits(PROT_MASK, 0)) {
|
|
calc_vm_prot_bits(PROT_MASK, 0)) {
|