Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a54b41bc authored by Indira Biruduraju's avatar Indira Biruduraju
Browse files

msm: kgsl: Remove VM_MAYWRITE flag to restrict mprotect



When VM_MAYWRITE flag is used during mmap(), mprotect()
can be used later to change the protection of memstore
to allow write. Make sure this does not happen by
removing VM_MAYWRITE from the vm_flags of vma.

Change-Id: I6f69f05858ea40611d512cfa796caabeaa88cdb5
Signed-off-by: default avatarIndira Biruduraju <ibirudur@codeaurora.org>
parent 28e16a8b
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -4480,6 +4480,8 @@ kgsl_mmap_memstore(struct kgsl_device *device, struct vm_area_struct *vma)
	if (vma->vm_flags & VM_WRITE)
		return -EPERM;

	vma->vm_flags &= ~VM_MAYWRITE;

	if (memdesc->size  !=  vma_size) {
		dev_err(device->dev,
			     "memstore bad size: %d should be %llu\n",