aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPing Yu <ping.yu@intel.com>2018-08-16 19:11:05 -0400
committerPing Yu <ping.yu@intel.com>2018-08-16 19:11:05 -0400
commita0c29a9a8af284891e8805092a6cd379ea9d3657 (patch)
treecf4274a2358d52a80cbeb0ab6868becc62ef3bb2 /src
parente29cb67b7c731fb513723a7cd35a46cc6e44fbc1 (diff)
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>
Diffstat (limited to 'src')
-rw-r--r--src/vnet/tls/tls.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/vnet/tls/tls.c b/src/vnet/tls/tls.c
index cea449163f8..88b4548c3aa 100644
--- a/src/vnet/tls/tls.c
+++ b/src/vnet/tls/tls.c
@@ -156,14 +156,15 @@ tls_notify_app_accept (tls_ctx_t * ctx)
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");