aboutsummaryrefslogtreecommitdiff
path: root/core/kernel/tee_ta_manager.c
diff options
context:
space:
mode:
authorEtienne Carriere <etienne.carriere@linaro.org>2019-05-07 11:29:11 +0200
committerJérôme Forissier <jerome.forissier@linaro.org>2019-05-07 16:16:24 +0200
commit6e59bb1e95f0b3334d2f06a1312e9e395bb1232c (patch)
tree37fd628e6c7de53801a5dd0dca94412432d34f11 /core/kernel/tee_ta_manager.c
parentd62792a008c4cba8ab7f63c4abc733dcb5d7c17c (diff)
core: handle user TA context released from session
Change is_user_ta_ctx() to support NULL context reference. For such references the function now returns boolean value false. This allows caller to nicely abort their sequence when the context reference is already released from the session instance. Note that caller shall not assume a context refer to a PTA when is_user_ta_ctx() return false, it shall call is_pseudo_ta_ctx(). A side effect is that few test on reference and function return value can be simplified. This change also ensures TA dump_state() function does not crash when called provides a null context reference. Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org> Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>
Diffstat (limited to 'core/kernel/tee_ta_manager.c')
-rw-r--r--core/kernel/tee_ta_manager.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/core/kernel/tee_ta_manager.c b/core/kernel/tee_ta_manager.c
index 8b9ccf56..ce6a93de 100644
--- a/core/kernel/tee_ta_manager.c
+++ b/core/kernel/tee_ta_manager.c
@@ -330,7 +330,7 @@ static bool check_params(struct tee_ta_session *sess,
* When CFG_SECURE_DATA_PATH is enabled, OP-TEE entry allows SHM and
* SDP memory references. Only TAs flagged SDP can access SDP memory.
*/
- if (sess->ctx->flags & TA_FLAG_SECURE_DATA_PATH)
+ if (sess->ctx && sess->ctx->flags & TA_FLAG_SECURE_DATA_PATH)
return true;
for (n = 0; n < TEE_NUM_PARAMS; n++) {
@@ -734,7 +734,7 @@ static void update_current_ctx(struct thread_specific_data *tsd)
* If ctx->mmu == NULL we must not have user mapping active,
* if ctx->mmu != NULL we must have user mapping active.
*/
- if (((ctx && is_user_ta_ctx(ctx) ?
+ if (((is_user_ta_ctx(ctx) ?
to_user_ta_ctx(ctx)->vm_info : NULL) == NULL) ==
core_mmu_user_mapping_is_active())
panic("unexpected active mapping");
@@ -787,6 +787,11 @@ static void dump_state(struct tee_ta_ctx *ctx)
struct tee_ta_session *s = NULL;
bool active __maybe_unused;
+ if (!ctx) {
+ EMSG("No TA status: null context reference");
+ return;
+ }
+
active = ((tee_ta_get_current_session(&s) == TEE_SUCCESS) &&
s && s->ctx == ctx);