From: Diego Fronza Date: Mon, 29 Mar 2021 17:04:12 +0000 (-0300) Subject: Fix following up lookup failure if more resolvers are available X-Git-Tag: v9.17.13~40^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=4d6408b82362c71ea04520083a3c6f4336ea4a1d;p=thirdparty%2Fbind9.git Fix following up lookup failure if more resolvers are available _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. --- diff --git a/bin/dig/dighost.c b/bin/dig/dighost.c index 9473219c2a6..a4a2ebdaf16 100644 --- a/bin/dig/dighost.c +++ b/bin/dig/dighost.c @@ -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); } }