aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/s3c_mem.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char/s3c_mem.c')
-rw-r--r--drivers/char/s3c_mem.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/drivers/char/s3c_mem.c b/drivers/char/s3c_mem.c
index 3e09dda..a8546d0 100644
--- a/drivers/char/s3c_mem.c
+++ b/drivers/char/s3c_mem.c
@@ -32,6 +32,7 @@
#include <linux/slab.h>
#include <linux/mman.h>
#include <linux/dma-mapping.h>
+#include <linux/cma.h>
#include <linux/unistd.h>
#include <linux/version.h>
@@ -324,6 +325,14 @@ long s3c_mem_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
mutex_unlock(&mem_share_alloc_lock);
return -EFAULT;
}
+
+ if (!cma_is_registered_region(param.phy_addr, param.size)) {
+ pr_err("%s: %#x@%#x is allowed to map\n",
+ __func__, param.size, param.phy_addr);
+ mutex_unlock(&mem_cacheable_share_alloc_lock);
+ return -EINVAL;
+ }
+
flag = MEM_ALLOC_SHARE;
physical_address = param.phy_addr;
DEBUG("param.phy_addr = %08x, %d\n",
@@ -361,6 +370,14 @@ long s3c_mem_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
mutex_unlock(&mem_cacheable_share_alloc_lock);
return -EFAULT;
}
+
+ if (!cma_is_registered_region(param.phy_addr, param.size)) {
+ pr_err("%s: %#x@%#x is allowed to map\n",
+ __func__, param.size, param.phy_addr);
+ mutex_unlock(&mem_cacheable_share_alloc_lock);
+ return -EINVAL;
+ }
+
flag = MEM_ALLOC_CACHEABLE_SHARE;
physical_address = param.phy_addr;
DEBUG("param.phy_addr = %08x, %d\n",