summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPim van Pelt <pim@ipng.nl>2021-08-26 15:49:17 +0200
committerMatthew Smith <mgsmith@netgate.com>2021-09-08 22:08:28 +0000
commit7b46e4bc574e6dfa7f5a454a696476744625c55f (patch)
tree4e1de45aa6a5877c7a73262f11ddce3eacd16d9d
parent0d56f60c8c9c3c86b6b47f369d23b8c79366aedf (diff)
linux-cp: fix crash on failed vlib_buffer_copy
Type: fix Signed-off-by: Pim van Pelt <pim@ipng.nl> Change-Id: I390282ecc63600728cf11413510c0169178e305c
-rw-r--r--src/plugins/linux-cp/lcp_node.c36
1 files changed, 24 insertions, 12 deletions
diff --git a/src/plugins/linux-cp/lcp_node.c b/src/plugins/linux-cp/lcp_node.c
index b2ffc5fb63f..3a88c3b0a52 100644
--- a/src/plugins/linux-cp/lcp_node.c
+++ b/src/plugins/linux-cp/lcp_node.c
@@ -671,10 +671,14 @@ VLIB_NODE_FN (lcp_arp_phy_node)
c0 = vlib_buffer_copy (vm, b0);
vlib_buffer_advance (b0, len0);
- /* Send to the host */
- vnet_buffer (c0)->sw_if_index[VLIB_TX] =
- lip0->lip_host_sw_if_index;
- reply_copies[n_copies++] = vlib_get_buffer_index (vm, c0);
+ if (c0)
+ {
+ /* Send to the host */
+ vnet_buffer (c0)->sw_if_index[VLIB_TX] =
+ lip0->lip_host_sw_if_index;
+ reply_copies[n_copies++] =
+ vlib_get_buffer_index (vm, c0);
+ }
}
}
if (arp1->opcode == clib_host_to_net_u16 (ETHERNET_ARP_OPCODE_reply))
@@ -699,10 +703,14 @@ VLIB_NODE_FN (lcp_arp_phy_node)
c1 = vlib_buffer_copy (vm, b1);
vlib_buffer_advance (b1, len1);
- /* Send to the host */
- vnet_buffer (c1)->sw_if_index[VLIB_TX] =
- lip1->lip_host_sw_if_index;
- reply_copies[n_copies++] = vlib_get_buffer_index (vm, c1);
+ if (c1)
+ {
+ /* Send to the host */
+ vnet_buffer (c1)->sw_if_index[VLIB_TX] =
+ lip1->lip_host_sw_if_index;
+ reply_copies[n_copies++] =
+ vlib_get_buffer_index (vm, c1);
+ }
}
}
@@ -771,10 +779,14 @@ VLIB_NODE_FN (lcp_arp_phy_node)
c0 = vlib_buffer_copy (vm, b0);
vlib_buffer_advance (b0, len0);
- /* Send to the host */
- vnet_buffer (c0)->sw_if_index[VLIB_TX] =
- lip0->lip_host_sw_if_index;
- reply_copies[n_copies++] = vlib_get_buffer_index (vm, c0);
+ if (c0)
+ {
+ /* Send to the host */
+ vnet_buffer (c0)->sw_if_index[VLIB_TX] =
+ lip0->lip_host_sw_if_index;
+ reply_copies[n_copies++] =
+ vlib_get_buffer_index (vm, c0);
+ }
}
}