From 49017aa9e80dbdb44cbfe8f4aa3b5edd9466705c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Espen=20Fjellv=C3=A6r=20Olsen?= Date: Tue, 8 Jan 2013 21:30:59 +0100 Subject: Update to the exynos-mem security issue from Samsung I9300 Update7 p2: includes the secmem changes as well as Andreis MFC addition as well Change-Id: I144c2b42586f07b737fba09742315683cbab36ef --- drivers/char/exynos_mem.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'drivers/char/exynos_mem.c') diff --git a/drivers/char/exynos_mem.c b/drivers/char/exynos_mem.c index 85c7a29..cf546a1 100644 --- a/drivers/char/exynos_mem.c +++ b/drivers/char/exynos_mem.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include @@ -83,6 +84,12 @@ static void cache_maint_phys(phys_addr_t start, size_t length, enum cacheop op) size_t left = length; phys_addr_t begin = start; + if (!cma_is_registered_region(start, length)) { + pr_err("[%s] handling non-cma region (%#x@%#x) is prohibited\n", + __func__, length, start); + return; + } + if (!soc_is_exynos5250() && !soc_is_exynos5210()) { if (length > (size_t) L1_FLUSH_ALL) { flush_cache_all(); @@ -257,10 +264,9 @@ int exynos_mem_mmap(struct file *filp, struct vm_area_struct *vma) pfn = mem->phybase; } - /* TODO: currently lowmem is only avaiable */ - if ((phys_to_virt(start) < (void *)PAGE_OFFSET) || - (phys_to_virt(start) >= high_memory)) { - pr_err("[%s] invalid paddr(0x%08x)\n", __func__, start); + if (!cma_is_registered_region(start, size)) { + pr_err("[%s] handling non-cma region (%#x@%#x) is prohibited\n", + __func__, size, start); return -EINVAL; } -- cgit v1.1