diff options
author | Olof Johansson <olof@lixom.net> | 2020-01-06 20:20:40 +0300 |
---|---|---|
committer | Olof Johansson <olof@lixom.net> | 2020-01-06 20:20:41 +0300 |
commit | 850e0a99361b6fd88f8def26f9422a0561654c2f (patch) | |
tree | a05d127c06bbe31d15e4193bf4c148f237f1983d | |
parent | 8396bdc008fc70f4826de8a1d6d48f59dfd6d030 (diff) | |
parent | 5a769f6ff439cedc547395a6dc78faa26108f741 (diff) | |
download | linux-850e0a99361b6fd88f8def26f9422a0561654c2f.tar.xz |
Merge tag 'tee-optee-fix-for-5.5' of git://git.linaro.org:/people/jens.wiklander/linux-tee into arm/fixes
Fix OP-TEE multi page dynamic shm pool alloc
* tag 'tee-optee-fix-for-5.5' of git://git.linaro.org:/people/jens.wiklander/linux-tee:
optee: Fix multi page dynamic shm pool alloc
Link: https://lore.kernel.org/r/20200103103710.GA3469@jax
Signed-off-by: Olof Johansson <olof@lixom.net>
-rw-r--r-- | drivers/tee/optee/shm_pool.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/drivers/tee/optee/shm_pool.c b/drivers/tee/optee/shm_pool.c index 0332a5301d61..d767eebf30bd 100644 --- a/drivers/tee/optee/shm_pool.c +++ b/drivers/tee/optee/shm_pool.c @@ -28,9 +28,22 @@ static int pool_op_alloc(struct tee_shm_pool_mgr *poolm, shm->size = PAGE_SIZE << order; if (shm->flags & TEE_SHM_DMA_BUF) { + unsigned int nr_pages = 1 << order, i; + struct page **pages; + + pages = kcalloc(nr_pages, sizeof(pages), GFP_KERNEL); + if (!pages) + return -ENOMEM; + + for (i = 0; i < nr_pages; i++) { + pages[i] = page; + page++; + } + shm->flags |= TEE_SHM_REGISTER; - rc = optee_shm_register(shm->ctx, shm, &page, 1 << order, + rc = optee_shm_register(shm->ctx, shm, pages, nr_pages, (unsigned long)shm->kaddr); + kfree(pages); } return rc; |