diff --git a/kernel/ashmem/ashmem.c b/kernel/ashmem/ashmem.c index d12ce74..c846db6 100644 --- a/kernel/ashmem/ashmem.c +++ b/kernel/ashmem/ashmem.c @@ -33,6 +33,7 @@ #include #include #include +#include #include "ashmem.h" #define ASHMEM_NAME_PREFIX "dev/ashmem/" @@ -373,8 +374,13 @@ static int ashmem_mmap(struct file *file, struct vm_area_struct *vma) } /* requested protection bits must match our allowed protection mask */ +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 0) + if (unlikely((vma->vm_flags & ~calc_vm_prot_bits(asma->prot_mask, 0)) & + calc_vm_prot_bits(PROT_MASK, 0))) { +#else if (unlikely((vma->vm_flags & ~calc_vm_prot_bits(asma->prot_mask)) & calc_vm_prot_bits(PROT_MASK))) { +#endif ret = -EPERM; goto out; }