From 42b29ba3d4a30e4bf660f3a0a6a4af40d62861fe Mon Sep 17 00:00:00 2001 From: Nathan Skrzypczak Date: Mon, 17 Aug 2020 14:14:56 +0200 Subject: vppinfra: fix RC in bihash instantiation There can be a race condition in the case a thread tries to do a bihash_search while another instantiates the bihash. Type: fix Change-Id: Ic61b590763beb409e112957c43a5a66cd10afb28 Signed-off-by: Nathan Skrzypczak --- src/vppinfra/bihash_template.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/vppinfra/bihash_template.c') diff --git a/src/vppinfra/bihash_template.c b/src/vppinfra/bihash_template.c index 02d84abd9eb..aac66cbf53b 100644 --- a/src/vppinfra/bihash_template.c +++ b/src/vppinfra/bihash_template.c @@ -893,7 +893,7 @@ u8 *BV (format_bihash) (u8 * s, va_list * args) s = format (s, "Hash table %s\n", h->name ? h->name : (u8 *) "(unnamed)"); #if BIHASH_LAZY_INSTANTIATE - if (PREDICT_FALSE (alloc_arena (h) == 0)) + if (PREDICT_FALSE (h->instantiated == 0)) return format (s, "[empty, uninitialized]"); #endif @@ -994,7 +994,7 @@ void BV (clib_bihash_foreach_key_value_pair) #if BIHASH_LAZY_INSTANTIATE - if (PREDICT_FALSE (alloc_arena (h) == 0)) + if (PREDICT_FALSE (h->instantiated == 0)) return; #endif -- cgit 1.2.3-korg