ANDROID: 16K: ashmem: Fix size check

In page-compat mode, all VMAs are forced to be a multiple of
the emulated page-size.

Bug: 383389337
Bug: 315325080
Bug: 302403436
Change-Id: I5c083cedc15c6837803efa497450c4df5331968f
Signed-off-by: Kalesh Singh <kaleshsingh@google.com>
This commit is contained in:
Kalesh Singh
2023-11-09 23:21:07 -08:00
committed by Carlos Llamas
parent df9123472f
commit a1e630ea0d

View File

@@ -20,6 +20,7 @@
#include <linux/mm.h>
#include <linux/mman.h>
#include <linux/uaccess.h>
#include <linux/page_size_compat.h>
#include <linux/personality.h>
#include <linux/bitops.h>
#include <linux/mutex.h>
@@ -386,7 +387,7 @@ static int ashmem_mmap(struct file *file, struct vm_area_struct *vma)
}
/* requested mapping size larger than object size */
if (vma->vm_end - vma->vm_start > PAGE_ALIGN(asma->size)) {
if (vma->vm_end - vma->vm_start > __PAGE_ALIGN(asma->size)) {
ret = -EINVAL;
goto out;
}