From 1013c0930e11e8a24d66da3dbdea26f72d25cbc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Thu, 11 Jun 2020 13:01:26 +0200 Subject: [PATCH] Add missing acquire memory barrier in isc_nmhandle_unref The ThreadSanitizer uses system synchronization primitives to check for data race. The netmgr handle->references was missing acquire memory barrier before resetting and reusing the memory occupied by isc_nmhandle_t. --- lib/isc/netmgr/netmgr.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/isc/netmgr/netmgr.c b/lib/isc/netmgr/netmgr.c index 9e4b692f80..35469b6dff 100644 --- a/lib/isc/netmgr/netmgr.c +++ b/lib/isc/netmgr/netmgr.c @@ -1156,6 +1156,8 @@ isc_nmhandle_unref(isc_nmhandle_t *handle) { if (isc_refcount_decrement(&handle->references) > 1) { return; } + /* We need an acquire memory barrier here */ + (void)isc_refcount_current(&handle->references); sock = handle->sock; handle->sock = NULL;