diff options
author | Sumit Garg <sumit.garg@linaro.org> | 2019-11-08 16:57:14 +0530 |
---|---|---|
committer | Jens Wiklander <jens.wiklander@linaro.org> | 2019-11-15 11:31:11 +0100 |
commit | a249dd200d03791cab23e47571f3e13d9c72af6c (patch) | |
tree | a4ccc6e51e90c9f04e8ff33703894839193ec55e /drivers/tee/optee/call.c | |
parent | 4f5cafb5cb8471e54afdc9054d973535614f7675 (diff) |
tee: optee: Fix dynamic shm pool allocations
In case of dynamic shared memory pool, kernel memory allocated using
dmabuf_mgr pool needs to be registered with OP-TEE prior to its usage
during optee_open_session() or optee_invoke_func().
So fix dmabuf_mgr pool allocations via an additional call to
optee_shm_register().
Also, allow kernel pages to be registered as shared memory with OP-TEE.
Fixes: 9733b072a12a ("optee: allow to work without static shared memory")
Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
Diffstat (limited to 'drivers/tee/optee/call.c')
-rw-r--r-- | drivers/tee/optee/call.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/tee/optee/call.c b/drivers/tee/optee/call.c index 13b0269a0abc..cf2367ba08d6 100644 --- a/drivers/tee/optee/call.c +++ b/drivers/tee/optee/call.c @@ -554,6 +554,13 @@ static int check_mem_type(unsigned long start, size_t num_pages) struct mm_struct *mm = current->mm; int rc; + /* + * Allow kernel address to register with OP-TEE as kernel + * pages are configured as normal memory only. + */ + if (virt_addr_valid(start)) + return 0; + down_read(&mm->mmap_sem); rc = __check_mem_type(find_vma(mm, start), start + num_pages * PAGE_SIZE); |