Skip to content

Commit 11eac29

Browse files
committed
ODROID-C2: gpu/ump: fix crash error caused by 'mmap()'
This patch is contributed by 'scpcom' in Hardkernel's forum. * http://seafile.servator.de/sbc/odroid/build/linux-3.16.y-amlogic-gpu_arm_fix_mmap_permissions.patch Change-Id: I250e6a8fe96895135a39babf156aaff702c61606 Signed-off-by: Dongjin Kim <[email protected]>
1 parent 0d11c06 commit 11eac29

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

drivers/gpu/arm/ump/linux/ump_kernel_linux.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -512,6 +512,17 @@ static int ump_file_mmap(struct file *filp, struct vm_area_struct *vma)
512512
/* By setting this flag, during a process fork; the child process will not have the parent UMP mappings */
513513
vma->vm_flags |= VM_DONTCOPY;
514514

515+
/* Test if we can make the mapping writable */
516+
if (mapping_map_writable(filp->f_mapping)) {
517+
/* On error, we need to allow it for forced VM_SHARED */
518+
mapping_allow_writable(filp->f_mapping);
519+
DBG_MSG(3, ("UMP Map function: Forcing allow writable\n"));
520+
}
521+
else {
522+
/* On success, the counter got incremented, decrement the counter */
523+
mapping_unmap_writable(filp->f_mapping);
524+
}
525+
515526
DBG_MSG(4, ("UMP vma->flags: %x\n", vma->vm_flags));
516527

517528
/* Call the common mmap handler */

0 commit comments

Comments
 (0)