Skip to content
Snippets Groups Projects
Commit e2cda3d9 authored by Jens Wiklander's avatar Jens Wiklander Committed by Yang Yingliang
Browse files

tee: remove linked list of struct tee_shm


mainline inclusion
from mainline-v5.7-rc1
commit 59a135f6
category: cleanup
bugzilla: NA
CVE: NA

Prepare for fixing CVE-2021-44733.
--------------------------------

Removes list_shm from struct tee_context since the linked list isn't used
any longer.

Signed-off-by: default avatarJens Wiklander <jens.wiklander@linaro.org>
Conflicts:
  drivers/tee/tee_core.c
[yyl: adjust context]
Reviewed-by: default avatarXiu Jianfeng <xiujianfeng@huawei.com>
Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
parent baeaf1da
Branches
Tags
No related merge requests found
...@@ -56,7 +56,6 @@ static int tee_open(struct inode *inode, struct file *filp) ...@@ -56,7 +56,6 @@ static int tee_open(struct inode *inode, struct file *filp)
kref_init(&ctx->refcount); kref_init(&ctx->refcount);
ctx->teedev = teedev; ctx->teedev = teedev;
INIT_LIST_HEAD(&ctx->list_shm);
filp->private_data = ctx; filp->private_data = ctx;
rc = teedev->desc->ops->open(ctx); rc = teedev->desc->ops->open(ctx);
if (rc) if (rc)
......
...@@ -26,8 +26,6 @@ static void tee_shm_release(struct tee_shm *shm) ...@@ -26,8 +26,6 @@ static void tee_shm_release(struct tee_shm *shm)
mutex_lock(&teedev->mutex); mutex_lock(&teedev->mutex);
idr_remove(&teedev->idr, shm->id); idr_remove(&teedev->idr, shm->id);
if (shm->ctx)
list_del(&shm->link);
mutex_unlock(&teedev->mutex); mutex_unlock(&teedev->mutex);
if (shm->flags & TEE_SHM_POOL) { if (shm->flags & TEE_SHM_POOL) {
...@@ -183,12 +181,8 @@ static struct tee_shm *__tee_shm_alloc(struct tee_context *ctx, ...@@ -183,12 +181,8 @@ static struct tee_shm *__tee_shm_alloc(struct tee_context *ctx,
} }
} }
if (ctx) { if (ctx)
teedev_ctx_get(ctx); teedev_ctx_get(ctx);
mutex_lock(&teedev->mutex);
list_add_tail(&shm->link, &ctx->list_shm);
mutex_unlock(&teedev->mutex);
}
return shm; return shm;
err_rem: err_rem:
...@@ -315,10 +309,6 @@ struct tee_shm *tee_shm_register(struct tee_context *ctx, unsigned long addr, ...@@ -315,10 +309,6 @@ struct tee_shm *tee_shm_register(struct tee_context *ctx, unsigned long addr,
} }
} }
mutex_lock(&teedev->mutex);
list_add_tail(&shm->link, &ctx->list_shm);
mutex_unlock(&teedev->mutex);
return shm; return shm;
err: err:
if (shm) { if (shm) {
......
...@@ -50,7 +50,6 @@ struct tee_shm_pool; ...@@ -50,7 +50,6 @@ struct tee_shm_pool;
*/ */
struct tee_context { struct tee_context {
struct tee_device *teedev; struct tee_device *teedev;
struct list_head list_shm;
void *data; void *data;
struct kref refcount; struct kref refcount;
bool releasing; bool releasing;
...@@ -170,7 +169,6 @@ void tee_device_unregister(struct tee_device *teedev); ...@@ -170,7 +169,6 @@ void tee_device_unregister(struct tee_device *teedev);
* struct tee_shm - shared memory object * struct tee_shm - shared memory object
* @teedev: device used to allocate the object * @teedev: device used to allocate the object
* @ctx: context using the object, if NULL the context is gone * @ctx: context using the object, if NULL the context is gone
* @link link element
* @paddr: physical address of the shared memory * @paddr: physical address of the shared memory
* @kaddr: virtual address of the shared memory * @kaddr: virtual address of the shared memory
* @size: size of shared memory * @size: size of shared memory
...@@ -187,7 +185,6 @@ void tee_device_unregister(struct tee_device *teedev); ...@@ -187,7 +185,6 @@ void tee_device_unregister(struct tee_device *teedev);
struct tee_shm { struct tee_shm {
struct tee_device *teedev; struct tee_device *teedev;
struct tee_context *ctx; struct tee_context *ctx;
struct list_head link;
phys_addr_t paddr; phys_addr_t paddr;
void *kaddr; void *kaddr;
size_t size; size_t size;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment