From 084606befb45507e9241b5555f86196fe08530f6 Mon Sep 17 00:00:00 2001 From: John Lo Date: Tue, 19 Jun 2018 15:27:48 -0400 Subject: Check get packet template allocation failure (VPP-1321) After calling vlib_packet_template_get_packet(), make sure packet buffer is allocated before using it. Change-Id: Idb5199f4e2c9596137b2101e502d611f474a6ffe Signed-off-by: John Lo --- src/plugins/cdp/cdp_periodic.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/plugins/cdp/cdp_periodic.c') diff --git a/src/plugins/cdp/cdp_periodic.c b/src/plugins/cdp/cdp_periodic.c index c67af00c7a5..a4c4bb91765 100644 --- a/src/plugins/cdp/cdp_periodic.c +++ b/src/plugins/cdp/cdp_periodic.c @@ -195,6 +195,9 @@ send_hdlc_hello (cdp_main_t * cm, cdp_neighbor_t * n, int count) h0 = vlib_packet_template_get_packet (vm, &cm->packet_templates[n->packet_template_index], &bi0); + if (!h0) + break; + hw = vnet_get_sup_hw_interface (vnm, n->sw_if_index); t0 = (u8 *) & h0->cdp.data; @@ -251,6 +254,9 @@ send_srp_hello (cdp_main_t * cm, cdp_neighbor_t * n, int count) h0 = vlib_packet_template_get_packet (vm, &cm->packet_templates[n->packet_template_index], &bi0); + if (!h0) + break; + hw = vnet_get_sup_hw_interface (vnm, n->sw_if_index); t0 = (u8 *) & h0->cdp.data; -- cgit