Skip to content

Commit

Permalink
FAPI: Fix session cleanup.
Browse files Browse the repository at this point in the history
The session cleanup in error cases tried to flush a password session.
Fixes: tpm2-software#2735

Signed-off-by: Juergen Repp <[email protected]>
  • Loading branch information
JuergenReppSIT committed Dec 22, 2023
1 parent 166a553 commit 69442c2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/tss2-fapi/fapi_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -1204,7 +1204,7 @@ ifapi_session_clean(FAPI_CONTEXT *context)
if (context->policy_session && context->policy_session != ESYS_TR_NONE) {
Esys_FlushContext(context->esys, context->policy_session);
}
if (context->session1 != ESYS_TR_NONE) {
if (context->session1 != ESYS_TR_NONE && context->session1 != ESYS_TR_PASSWORD) {
if (context->session1 == context->session2) {
context->session2 = ESYS_TR_NONE;
}
Expand All @@ -1213,7 +1213,7 @@ ifapi_session_clean(FAPI_CONTEXT *context)
}
context->session1 = ESYS_TR_NONE;
}
if (context->session2 != ESYS_TR_NONE) {
if (context->session2 != ESYS_TR_NONE && context->policy_session != ESYS_TR_NONE) {
if (Esys_FlushContext(context->esys, context->session2) != TSS2_RC_SUCCESS) {
LOG_ERROR("Cleanup session failed.");
context->session2 = ESYS_TR_NONE;
Expand Down

0 comments on commit 69442c2

Please sign in to comment.