Fix a segment fault issue in TLS
The root cause is it uses a dangling reference after memory move
Need to call session_alloc first, then use index to get the app
listener point
Change-Id: If5b7e0d6ddc761e5327660c47ce620e375319b4d
Signed-off-by: Ping Yu <ping.yu@intel.com>
diff --git a/src/vnet/tls/tls.c b/src/vnet/tls/tls.c
index cea4491..88b4548 100644
--- a/src/vnet/tls/tls.c
+++ b/src/vnet/tls/tls.c
@@ -156,14 +156,15 @@
app = application_get (ctx->parent_app_index);
lctx = tls_listener_ctx_get (ctx->listener_ctx_index);
- app_listener = listen_session_get_from_handle (lctx->app_session_handle);
- sm = application_get_listen_segment_manager (app, app_listener);
app_session = session_alloc (vlib_get_thread_index ());
app_session->app_index = ctx->parent_app_index;
app_session->connection_index = ctx->tls_ctx_handle;
+
+ app_listener = listen_session_get_from_handle (lctx->app_session_handle);
app_session->session_type = app_listener->session_type;
app_session->listener_index = app_listener->session_index;
+ sm = application_get_listen_segment_manager (app, app_listener);
if ((rv = session_alloc_fifos (sm, app_session)))
{
TLS_DBG (1, "failed to allocate fifos");