]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Unlink the query under cleanup_query
authorAram Sargsyan <aram@isc.org>
Fri, 21 Oct 2022 08:08:37 +0000 (08:08 +0000)
committerAram Sargsyan <aram@isc.org>
Fri, 21 Oct 2022 08:08:37 +0000 (08:08 +0000)
In the cleanup code of fctx_query() function there is a code path
where 'query' is linked to 'fctx' and it is being destroyed.

Make sure that 'query' is unlinked before destroying it.

lib/dns/resolver.c

index 5d1e7291edcad5a0986fa9d05d650c3e3816317e..3f3c5f96c545fb85859e09a97208568eaf71ba47 100644 (file)
@@ -2335,6 +2335,12 @@ cleanup_dispatch:
        }
 
 cleanup_query:
+       LOCK(&fctx->bucket->lock);
+       if (ISC_LINK_LINKED(query, link)) {
+               atomic_fetch_sub_release(&fctx->nqueries, 1);
+               ISC_LIST_UNLINK(fctx->queries, query, link);
+       }
+       UNLOCK(&fctx->bucket->lock);
 
        query->magic = 0;
        dns_message_detach(&query->rmessage);