aboutsummaryrefslogtreecommitdiffstats
path: root/src/vcl
diff options
context:
space:
mode:
authorBenoît Ganne <bganne@cisco.com>2020-04-22 19:14:03 +0200
committerFlorin Coras <florin.coras@gmail.com>2020-04-22 18:42:52 +0000
commit38ab5672b599df8ef201ca6733c9b008c37fdfa3 (patch)
tree1feac124ab2088cee7a76b5e49e6f16529d62829 /src/vcl
parenta04adbf5368f9ec907508ff36d42fbd72d287120 (diff)
vcl: fix use-after-free
Make sure we disconnect from vlib prior to free-ing the last worker, as we'll need to access it. Type: fix Change-Id: Id5bdd17f0f5efa1ce52021b4270eb4f1e95cc61d Signed-off-by: Benoît Ganne <bganne@cisco.com>
Diffstat (limited to 'src/vcl')
-rw-r--r--src/vcl/vppcom.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/vcl/vppcom.c b/src/vcl/vppcom.c
index 186b08468fd..579cbc1657b 100644
--- a/src/vcl/vppcom.c
+++ b/src/vcl/vppcom.c
@@ -1224,12 +1224,13 @@ vppcom_app_destroy (void)
/* *INDENT-OFF* */
pool_foreach (wrk, vcm->workers, ({
+ if (pool_elts (vcm->workers) == 1)
+ vl_client_disconnect_from_vlib ();
vcl_worker_cleanup (wrk, 0 /* notify vpp */ );
}));
/* *INDENT-ON* */
vcl_elog_stop (vcm);
- vl_client_disconnect_from_vlib ();
/*
* Free the heap and fix vcm