summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVladislav Grishenko <themiron@yandex-team.ru>2021-11-20 14:52:53 +0500
committerAndrew Yourtchenko <ayourtch@gmail.com>2022-08-31 15:26:19 +0000
commit62fc78761c2a1e023f9483a54776cc66332ecacc (patch)
tree4178908d8c995f8eb8c5c239e9f985d8fbe28e36
parent6556a9944f291851a583e86ff7d8613e25c7f39e (diff)
gso: zero-initialize gho struct
It may contain garbage in debug builds resulting in wrong gho detected flags and offsets. Type: fix Signed-off-by: Vladislav Grishenko <themiron@yandex-team.ru> Change-Id: Ia79633262185016f527e7dc6c67334cda6f055f2
-rw-r--r--src/vnet/devices/virtio/device.c1
-rw-r--r--src/vnet/gso/node.c5
2 files changed, 6 insertions, 0 deletions
diff --git a/src/vnet/devices/virtio/device.c b/src/vnet/devices/virtio/device.c
index 4e4f899540f..0ae41141a5a 100644
--- a/src/vnet/devices/virtio/device.c
+++ b/src/vnet/devices/virtio/device.c
@@ -109,6 +109,7 @@ virtio_tx_trace (vlib_main_t *vm, vlib_node_runtime_t *node, vlib_buffer_t *b0,
t = vlib_add_trace (vm, node, b0, sizeof (t[0]));
t->sw_if_index = vnet_buffer (b0)->sw_if_index[VLIB_TX];
t->buffer_index = bi;
+ clib_memset (&t->gho, 0, sizeof (t->gho));
if (is_tun)
{
int is_ip4 = 0, is_ip6 = 0;
diff --git a/src/vnet/gso/node.c b/src/vnet/gso/node.c
index 97bccc8879c..d755784d0cb 100644
--- a/src/vnet/gso/node.c
+++ b/src/vnet/gso/node.c
@@ -581,6 +581,7 @@ vnet_gso_node_inline (vlib_main_t * vm,
t0->flags = b[0]->flags & VNET_BUFFER_F_GSO;
t0->gso_size = vnet_buffer2 (b[0])->gso_size;
t0->gso_l4_hdr_sz = vnet_buffer2 (b[0])->gso_l4_hdr_sz;
+ clib_memset (&t0->gho, 0, sizeof (t0->gho));
vnet_generic_header_offset_parser (b[0], &t0->gho, is_l2,
is_ip4, is_ip6);
}
@@ -590,6 +591,7 @@ vnet_gso_node_inline (vlib_main_t * vm,
t1->flags = b[1]->flags & VNET_BUFFER_F_GSO;
t1->gso_size = vnet_buffer2 (b[1])->gso_size;
t1->gso_l4_hdr_sz = vnet_buffer2 (b[1])->gso_l4_hdr_sz;
+ clib_memset (&t1->gho, 0, sizeof (t1->gho));
vnet_generic_header_offset_parser (b[1], &t1->gho, is_l2,
is_ip4, is_ip6);
}
@@ -599,6 +601,7 @@ vnet_gso_node_inline (vlib_main_t * vm,
t2->flags = b[2]->flags & VNET_BUFFER_F_GSO;
t2->gso_size = vnet_buffer2 (b[2])->gso_size;
t2->gso_l4_hdr_sz = vnet_buffer2 (b[2])->gso_l4_hdr_sz;
+ clib_memset (&t2->gho, 0, sizeof (t2->gho));
vnet_generic_header_offset_parser (b[2], &t2->gho, is_l2,
is_ip4, is_ip6);
}
@@ -608,6 +611,7 @@ vnet_gso_node_inline (vlib_main_t * vm,
t3->flags = b[3]->flags & VNET_BUFFER_F_GSO;
t3->gso_size = vnet_buffer2 (b[3])->gso_size;
t3->gso_l4_hdr_sz = vnet_buffer2 (b[3])->gso_l4_hdr_sz;
+ clib_memset (&t3->gho, 0, sizeof (t3->gho));
vnet_generic_header_offset_parser (b[3], &t3->gho, is_l2,
is_ip4, is_ip6);
}
@@ -661,6 +665,7 @@ vnet_gso_node_inline (vlib_main_t * vm,
t0->flags = b[0]->flags & VNET_BUFFER_F_GSO;
t0->gso_size = vnet_buffer2 (b[0])->gso_size;
t0->gso_l4_hdr_sz = vnet_buffer2 (b[0])->gso_l4_hdr_sz;
+ clib_memset (&t0->gho, 0, sizeof (t0->gho));
vnet_generic_header_offset_parser (b[0], &t0->gho, is_l2,
is_ip4, is_ip6);
}