summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorVolodymyr Babchuk <vlad.babchuk@gmail.com>2017-11-29 14:48:37 +0200
committerVictor Chong <victor.chong@linaro.org>2018-02-21 15:40:49 +0000
commit17c7c494f71816b458f7fc6f90b7043d8398cad4 (patch)
treeec48be5e64bc00411275842168a779e0ad8bbf34 /include/linux
parent9af8e19afc93bab16ea67525eeca4bfa459ce6ad (diff)
BACKPORT: tee: use reference counting for tee_context
We need to ensure that tee_context is present until last shared buffer will be freed. Change-Id: I0346e266f17b06af82144290d230029d0193a3d8 Signed-off-by: Volodymyr Babchuk <vlad.babchuk@gmail.com> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org> (cherry picked from commit 217e0250cccb9e54d457991446cd3fab413085e1) Signed-off-by: Victor Chong <victor.chong@linaro.org>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/tee_drv.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/linux/tee_drv.h b/include/linux/tee_drv.h
index 80963f665db3..484e5058abbd 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 {