summaryrefslogtreecommitdiffstats
path: root/src/vnet/session/session_api.c
diff options
context:
space:
mode:
authorFilip Tehlar <ftehlar@cisco.com>2022-03-11 11:12:56 +0000
committerFlorin Coras <florin.coras@gmail.com>2022-03-11 16:30:23 +0000
commit9c32f05751ca92239f0cc667a8d696dec86c9db8 (patch)
tree743443c576555aac5915c2982a6a1e20aed9fc43 /src/vnet/session/session_api.c
parent9652177bc12171bb7141ef7a92e0053204f7ed87 (diff)
session: fix crash during client detach
This fixes a crash caused by client closing socket before adding worker. During detach vpp tries to delete worker based on invalid worker index. Type: fix Signed-off-by: Filip Tehlar <ftehlar@cisco.com> Change-Id: I3242bcbb116ef5fd1d4c449f5bcf907e4e2f8f30
Diffstat (limited to 'src/vnet/session/session_api.c')
-rw-r--r--src/vnet/session/session_api.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/vnet/session/session_api.c b/src/vnet/session/session_api.c
index 615e2ade59c..2502ef6a70a 100644
--- a/src/vnet/session/session_api.c
+++ b/src/vnet/session/session_api.c
@@ -1485,7 +1485,9 @@ sapi_socket_detach (app_namespace_t * app_ns, clib_socket_t * cs)
/* Cleanup everything because app worker closed socket or crashed */
handle = (app_ns_api_handle_t *) & cs->private_data;
- app_wrk = app_worker_get (handle->aah_app_wrk_index);
+ app_wrk = app_worker_get_if_valid (handle->aah_app_wrk_index);
+ if (!app_wrk)
+ return;
vnet_app_worker_add_del_args_t args = {
.app_index = app_wrk->app_index,