aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2024-02-13 15:37:20 -0500
committerDave Wallace <dwallacelf@gmail.com>2024-03-01 14:29:29 +0000
commite4ec1584ec1dbc0f2d0343d4cf9c91455059789b (patch)
tree9e3bfa78815402bff3fd796025ba30f20965ab0d
parent7453b5dfe8a52d0e033ec675eba3ada26ba771a3 (diff)
tls: mark ho done atomically after ctx init
Make sure ctx is initialized before ho is marked as done. Type: fix Change-Id: If0525a9890a56e289e2ab006c669a9d64dc6505d Signed-off-by: Florin Coras <fcoras@cisco.com> (cherry picked from commit 0ded4890beaa3aa1f36c61ff6125d19582b25391)
-rw-r--r--src/vnet/tls/tls.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/vnet/tls/tls.c b/src/vnet/tls/tls.c
index a27d731aca0..358e3a7b2ef 100644
--- a/src/vnet/tls/tls.c
+++ b/src/vnet/tls/tls.c
@@ -594,12 +594,13 @@ tls_session_connected_cb (u32 tls_app_index, u32 ho_ctx_index,
u32 ctx_handle;
ho_ctx = tls_ctx_half_open_get (ho_ctx_index);
- ho_ctx->flags |= TLS_CONN_F_HO_DONE;
ctx_handle = tls_ctx_alloc (ho_ctx->tls_ctx_engine);
ctx = tls_ctx_get (ctx_handle);
clib_memcpy_fast (ctx, ho_ctx, sizeof (*ctx));
+
/* Half-open freed on tcp half-open cleanup notification */
+ __atomic_fetch_or (&ho_ctx->flags, TLS_CONN_F_HO_DONE, __ATOMIC_RELEASE);
ctx->c_thread_index = vlib_get_thread_index ();
ctx->tls_ctx_handle = ctx_handle;