A new resolver can be created while we currently run a check with the
old configuration. We will then request another check that runs in
parallel to the old check. If the new check finishes earlier, the
current check result will be overwritten by an outdated check result
which is likely wrong.
While here fix some whitespace.

I have only been able to trigger this artificially but I think it can
happen in the wild if we learn new autoconf forwarders at the wrong
time.

OK?

diff --git resolver.c resolver.c
index 49f51d8a9ab..7d65d511432 100644
--- resolver.c
+++ resolver.c
@@ -1513,8 +1513,6 @@ check_resolver(struct uw_resolver *resolver_to_check)
                evtimer_add(&resolver_to_check->check_ev,
                    &resolver_to_check->check_tv);
        }
-
-
 }
 
 void
@@ -1529,6 +1527,12 @@ check_resolver_done(struct uw_resolver *res, void *arg, 
int rcode,
 
        checked_resolver->check_running--;
 
+       if (checked_resolver != resolvers[checked_resolver->type]) {
+               log_debug("%s: %s: ignoring late check result", __func__,
+                   uw_resolver_type_str[checked_resolver->type]);
+               goto out;
+       }
+
        prev_state = checked_resolver->state;
 
        if (answer_len < LDNS_HEADER_SIZE) {


-- 
I'm not entirely sure you are real.

Reply via email to