l2: fix segment fault 12/42112/5
authorfenglei <[email protected]>
Thu, 9 Jan 2025 09:32:35 +0000 (17:32 +0800)
committerDave Wallace <[email protected]>
Wed, 5 Feb 2025 16:51:54 +0000 (16:51 +0000)
if feature_bitmap is zero, it will make feat_bitmap_get_next_node_index function generate segment fault

Type: fix

Change-Id: I6a9c0b29d927e600537e9e43ad696d09c091f9b1
Signed-off-by: fenglei <[email protected]>
src/vnet/l2/l2_input_node.c

index 76b9480..58a5417 100644 (file)
@@ -215,7 +215,10 @@ classify_and_dispatch (l2input_main_t * msm, vlib_buffer_t * b0, u16 * next0)
       vnet_buffer (b0)->sw_if_index[VLIB_TX] = config->output_sw_if_index;
     }
   else
-    feat_mask = L2INPUT_FEAT_DROP;
+    {
+      *next0 = L2INPUT_NEXT_DROP;
+      return;
+    }
 
   /* mask out features from bitmap using packet type and bd config */
   u32 feature_bitmap = config->feature_bitmap & feat_mask;