From bc82c01d0b23f55ed25363f749ba59c5822c0495 Mon Sep 17 00:00:00 2001 From: Ilya Maximets Date: Thu, 28 Nov 2024 14:18:16 +0100 Subject: [PATCH] ofproto-dpif-upcall: Fix use of uninitialized missed dumps counter. The first time revalidator checks the value - it is not initialized, so we may end up marking valid flows for deletion. WARNING: MemorySanitizer: use-of-uninitialized-value 0 0x6ee9e9 in revalidator_sweep__ ofproto/ofproto-dpif-upcall.c:3003:25 1 0x6ed671 in revalidator_purge ofproto/ofproto-dpif-upcall.c:3056:5 2 0x6e997d in udpif_stop_threads ofproto/ofproto-dpif-upcall.c:566:17 3 0x6ecf05 in udpif_flush ofproto/ofproto-dpif-upcall.c:756:5 4 0x60323e in flush ofproto/ofproto-dpif.c:2020:9 5 0x56b10e in ofproto_flush__ ofproto/ofproto.c:1669:9 6 0x56a67b in ofproto_destroy ofproto/ofproto.c:1821:5 7 0x4c9012 in bridge_destroy vswitchd/bridge.c:3644:9 8 0x4c7c13 in bridge_exit vswitchd/bridge.c:556:9 9 0x5261a8 in main vswitchd/ovs-vswitchd.c:147:5 10 0x7fa0bb in __libc_start_call_main 11 0x7fa0bb in __libc_start_main@GLIBC_2.2.5 12 0x432b24 in _start (vswitchd/ovs-vswitchd+0x432b24) Fixes: 180ab2fd635e ("ofproto-dpif-upcall: Avoid stale ukeys leaks.") Acked-by: Mike Pattrick Acked-by: Eelco Chaudron Signed-off-by: Ilya Maximets --- ofproto/ofproto-dpif-upcall.c | 1 + 1 file changed, 1 insertion(+) diff --git a/ofproto/ofproto-dpif-upcall.c b/ofproto/ofproto-dpif-upcall.c index 5c06beb16ae..52336c0c87e 100644 --- a/ofproto/ofproto-dpif-upcall.c +++ b/ofproto/ofproto-dpif-upcall.c @@ -1773,6 +1773,7 @@ ukey_create__(const struct nlattr *key, size_t key_len, ukey->state_thread = ovsthread_id_self(); ukey->state_where = OVS_SOURCE_LOCATOR; ukey->created = ukey->flow_time = time_msec(); + ukey->missed_dumps = 0; memset(&ukey->stats, 0, sizeof ukey->stats); ukey->stats.used = used; ukey->dp_layer = NULL;