crypto: drop the frame if there is no handler 42/35842/1
authorDastin Wilski <dastin.wilski@gmail.com>
Thu, 31 Mar 2022 09:55:09 +0000 (11:55 +0200)
committerDastin Wilski <dastin.wilski@gmail.com>
Thu, 31 Mar 2022 09:55:09 +0000 (11:55 +0200)
If async engines are disbaled and async is turned on vpp tries to
enqueue frame with nonexisting handler which leads to segfault.
This patch checks for handler and drops the frame in case it doesn't
exist.

Type: fix
Signed-off-by: Dastin Wilski <dastin.wilski@gmail.com>
Change-Id: I67211867ee29dc41cc9f0733e8e0b3ea86677f85

src/vnet/crypto/crypto.h

index eb38118..e24ad10 100644 (file)
@@ -599,6 +599,12 @@ vnet_crypto_async_submit_open_frame (vlib_main_t * vm,
   frame->state = VNET_CRYPTO_FRAME_STATE_PENDING;
   frame->enqueue_thread_index = vm->thread_index;
 
+  if (PREDICT_FALSE (cm->enqueue_handlers == NULL))
+    {
+      frame->state = VNET_CRYPTO_FRAME_STATE_ELT_ERROR;
+      return -1;
+    }
+
   int ret = (cm->enqueue_handlers[frame->op]) (vm, frame);
 
   if (PREDICT_TRUE (ret == 0))