]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Add missing acquire memory barrier in isc_nmhandle_unref
authorOndřej Surý <ondrej@isc.org>
Thu, 11 Jun 2020 11:01:26 +0000 (13:01 +0200)
committerOndřej Surý <ondrej@isc.org>
Thu, 11 Jun 2020 11:01:26 +0000 (13:01 +0200)
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

index 9e4b692f80163e35230d55126f27fca3e5f483d7..35469b6dff1ddd77e397905f0f2e3274755e8838 100644 (file)
@@ -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;