]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Fix following up lookup failure if more resolvers are available
authorDiego Fronza <diego@isc.org>
Mon, 29 Mar 2021 17:04:12 +0000 (14:04 -0300)
committerDiego Fronza <diego@isc.org>
Mon, 26 Apr 2021 14:14:14 +0000 (11:14 -0300)
_query_detach function was incorrectly unliking the query object from
the lookup->q query list, this made it impossible to follow a query
lookup failure with the next one in the list (possibly using a separate
resolver), as the link to the next query in the list was dissolved.

Fix by unliking the node only when the query object is about to be
destroyed, i.e. there is no more references to the object.

bin/dig/dighost.c

index 9473219c2a6d253d277a775e4a2df801d90840d1..a4a2ebdaf16a8200d6ea91c432c98579324c1dc0 100644 (file)
@@ -1692,14 +1692,13 @@ _query_detach(dig_query_t **queryp, const char *file, unsigned int line) {
                query_detach(&lookup->current_query);
        }
 
-       if (ISC_LINK_LINKED(query, link)) {
-               ISC_LIST_UNLINK(lookup->q, query, link);
-       }
-
        debug("%s:%u:query_detach(%p) = %" PRIuFAST32, file, line, query,
              isc_refcount_current(&query->references) - 1);
 
        if (isc_refcount_decrement(&query->references) == 1) {
+               if (ISC_LINK_LINKED(query, link)) {
+                       ISC_LIST_UNLINK(lookup->q, query, link);
+               }
                destroy_query(query, file, line);
        }
 }