summaryrefslogtreecommitdiffstats
path: root/src/vlibapi
diff options
context:
space:
mode:
authorwanghanlin <wanghanlin@corp.netease.com>2021-05-08 11:39:53 +0800
committerFlorin Coras <florin.coras@gmail.com>2021-05-10 04:42:58 +0000
commit9f42fff3efef2aa715c3d8a070f3ddc9106adfc8 (patch)
tree2e8e150ee4cc07421cdaf227c6b5cde7b2afbe5a /src/vlibapi
parent27e93a5d7692e4a7c9f60bea31cc9f8156356979 (diff)
api: fix crash in vl_msg_api_free
VPP crash when ASSERT in clib_mem_free. Type: fix Signed-off-by: wanghanlin <wanghanlin@corp.netease.com> Change-Id: Id06d833caab3385446528d62a6ed3bde38d57db0
Diffstat (limited to 'src/vlibapi')
-rw-r--r--src/vlibapi/api_shared.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/vlibapi/api_shared.c b/src/vlibapi/api_shared.c
index ec74b5fe357..65288d89f67 100644
--- a/src/vlibapi/api_shared.c
+++ b/src/vlibapi/api_shared.c
@@ -654,7 +654,21 @@ vl_msg_api_handler_with_vm_node (api_main_t * am, svm_region_t * vlib_rp,
* main thread without copying them...
*/
if (id >= vec_len (am->message_bounce) || !(am->message_bounce[id]))
- vl_msg_api_free (the_msg);
+ {
+ if (is_private)
+ {
+ old_vlib_rp = am->vlib_rp;
+ save_shmem_hdr = am->shmem_hdr;
+ am->vlib_rp = vlib_rp;
+ am->shmem_hdr = (void *) vlib_rp->user_ctx;
+ }
+ vl_msg_api_free (the_msg);
+ if (is_private)
+ {
+ am->vlib_rp = old_vlib_rp;
+ am->shmem_hdr = save_shmem_hdr;
+ }
+ }
if (PREDICT_FALSE (am->elog_trace_api_messages))
{