mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-26 19:00:25 +00:00
optee: Fix multi page dynamic shm pool alloc
[ Upstream commit5a769f6ff4
] optee_shm_register() expected pages to be passed as an array of page pointers rather than as an array of contiguous pages. So fix that via correctly passing pages as per expectation. Fixes:a249dd200d
("tee: optee: Fix dynamic shm pool allocations") Reported-by: Vincent Cao <vincent.t.cao@intel.com> Signed-off-by: Sumit Garg <sumit.garg@linaro.org> Tested-by: Vincent Cao <vincent.t.cao@intel.com> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
88532d1e64
commit
15763f047e
1 changed files with 14 additions and 1 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue