Skip to content

Commit

Permalink
core: fix the keepalive condition in close session
Browse files Browse the repository at this point in the history
According to the The GP Internal Core API v1.1:
The keepalive flag should be ignored when the single instance flag is
not set.

Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
Signed-off-by: Zeng Tao <prime.zeng@hisilicon.com>
  • Loading branch information
prime-zeng authored and jforissier committed Jun 6, 2017
1 parent e38a9ab commit f9a64f1
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion core/kernel/tee_ta_manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,7 @@ TEE_Result tee_ta_close_session(struct tee_ta_session *csess,
{
struct tee_ta_session *sess;
struct tee_ta_ctx *ctx;
bool keep_alive;

DMSG("tee_ta_close_session(0x%" PRIxVA ")", (vaddr_t)csess);

Expand Down Expand Up @@ -416,7 +417,9 @@ TEE_Result tee_ta_close_session(struct tee_ta_session *csess,
panic();

ctx->ref_count--;
if (!ctx->ref_count && !(ctx->flags & TA_FLAG_INSTANCE_KEEP_ALIVE)) {
keep_alive = (ctx->flags & TA_FLAG_INSTANCE_KEEP_ALIVE) &&
(ctx->flags & TA_FLAG_SINGLE_INSTANCE);
if (!ctx->ref_count && !keep_alive) {
DMSG(" ... Destroy TA ctx");

TAILQ_REMOVE(&tee_ctxes, ctx, link);
Expand Down

0 comments on commit f9a64f1

Please sign in to comment.