Skip to content

Commit 850e0a9

Browse files
committed
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>
2 parents 8396bdc + 5a769f6 commit 850e0a9

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

drivers/tee/optee/shm_pool.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,22 @@ static int pool_op_alloc(struct tee_shm_pool_mgr *poolm,
2828
shm->size = PAGE_SIZE << order;
2929

3030
if (shm->flags & TEE_SHM_DMA_BUF) {
31+
unsigned int nr_pages = 1 << order, i;
32+
struct page **pages;
33+
34+
pages = kcalloc(nr_pages, sizeof(pages), GFP_KERNEL);
35+
if (!pages)
36+
return -ENOMEM;
37+
38+
for (i = 0; i < nr_pages; i++) {
39+
pages[i] = page;
40+
page++;
41+
}
42+
3143
shm->flags |= TEE_SHM_REGISTER;
32-
rc = optee_shm_register(shm->ctx, shm, &page, 1 << order,
44+
rc = optee_shm_register(shm->ctx, shm, pages, nr_pages,
3345
(unsigned long)shm->kaddr);
46+
kfree(pages);
3447
}
3548

3649
return rc;

0 commit comments

Comments
 (0)