From a2bd8339095c99b4f0faea0f1bc39128c048c3aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Thu, 19 Mar 2026 03:42:08 +0100 Subject: [PATCH] Fix data race on fctx->vresult in validated() 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 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/dns/resolver.c b/lib/dns/resolver.c index a708bd0f0b..bf800ff067 100644 --- a/lib/dns/resolver.c +++ b/lib/dns/resolver.c @@ -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)) {