From 78681def21b931309a779dfc6a5cbc6ff8b1f814 Mon Sep 17 00:00:00 2001 From: Matthew Smith Date: Thu, 10 Sep 2020 10:09:01 -0500 Subject: l2: fix null deref in l2_to_bvi() Type: fix Static analysis identified a possible null pointer dereference. It was introduced by a recent patch which expanded the DMAC comparison on inbound packets on a BVI interface to include any secondary MAC addresses which were added to an interface. Check if the pointer is null before dereferencing. Change-Id: Ic2afe2b062eda32977e05bf3f98d82c1fe64620c Signed-off-by: Matthew Smith --- src/vnet/l2/l2_bvi.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/vnet/l2/l2_bvi.h') diff --git a/src/vnet/l2/l2_bvi.h b/src/vnet/l2/l2_bvi.h index 300ea81bbf0..697e25bf3de 100644 --- a/src/vnet/l2/l2_bvi.h +++ b/src/vnet/l2/l2_bvi.h @@ -72,7 +72,7 @@ l2_to_bvi (vlib_main_t * vlib_main, ethernet_interface_t *ei = ethernet_get_interface (em, hi->hw_if_index); u32 rv; - if (PREDICT_FALSE (vec_len (ei->secondary_addrs) > 0)) + if (PREDICT_FALSE (ei && (vec_len (ei->secondary_addrs) > 0))) rv = l2_to_bvi_dmac_check (hi, e0->dst_address, ei, 1 /* have_sec_dmac */ ); else -- cgit 1.2.3-korg