]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Fix data race on fctx->vresult in validated()
authorOndřej Surý <ondrej@isc.org>
Thu, 19 Mar 2026 02:42:08 +0000 (03:42 +0100)
committerOndřej Surý <ondrej@isc.org>
Thu, 19 Mar 2026 23:56:19 +0000 (00:56 +0100)
Move the write to fctx->vresult after LOCK(&fctx->lock).  The field was
being set before acquiring the lock, but dns_resolver_logfetch() reads
it under the same lock from another thread.

lib/dns/resolver.c

index a708bd0f0b109aba0a041b35b4685487a0fa6a64..bf800ff067ed013e65b44b7a792c7d6b84c47996 100644 (file)
@@ -5626,7 +5626,6 @@ validated(void *arg) {
        addrinfo = valarg->addrinfo;
 
        message = val->message;
-       fctx->vresult = val->result;
 
        FCTXTRACE("received validation completion event");
 
@@ -5634,6 +5633,8 @@ validated(void *arg) {
 
        LOCK(&fctx->lock);
 
+       fctx->vresult = val->result;
+
        ISC_LIST_UNLINK(fctx->validators, val, link);
 
        if (SHUTTINGDOWN(fctx)) {