diff options
author | Volodymyr Babchuk <vlad.babchuk@gmail.com> | 2017-11-29 14:48:37 +0200 |
---|---|---|
committer | Jens Wiklander <jens.wiklander@linaro.org> | 2017-12-15 13:36:18 +0100 |
commit | 217e0250cccb9e54d457991446cd3fab413085e1 (patch) | |
tree | 42906632546d8fe35890ac41a019f641fc1055a2 /include/linux/tee_drv.h | |
parent | f58e236c9d665ad0af99c908de4a9b6f07e74dda (diff) | |
download | linux-217e0250cccb9e54d457991446cd3fab413085e1.tar.gz linux-217e0250cccb9e54d457991446cd3fab413085e1.tar.bz2 linux-217e0250cccb9e54d457991446cd3fab413085e1.zip |
tee: use reference counting for tee_context
We need to ensure that tee_context is present until last
shared buffer will be freed.
Signed-off-by: Volodymyr Babchuk <vlad.babchuk@gmail.com>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
Diffstat (limited to 'include/linux/tee_drv.h')
-rw-r--r-- | include/linux/tee_drv.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/include/linux/tee_drv.h b/include/linux/tee_drv.h index 0f86a480c204..157e8d06bf49 100644 --- a/include/linux/tee_drv.h +++ b/include/linux/tee_drv.h @@ -17,6 +17,7 @@ #include <linux/types.h> #include <linux/idr.h> +#include <linux/kref.h> #include <linux/list.h> #include <linux/tee.h> @@ -42,11 +43,17 @@ struct tee_shm_pool; * @teedev: pointer to this drivers struct tee_device * @list_shm: List of shared memory object owned by this context * @data: driver specific context data, managed by the driver + * @refcount: reference counter for this structure + * @releasing: flag that indicates if context is being released right now. + * It is needed to break circular dependency on context during + * shared memory release. */ struct tee_context { struct tee_device *teedev; struct list_head list_shm; void *data; + struct kref refcount; + bool releasing; }; struct tee_param_memref { |