]> 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:36:34 +0000 (08:36 +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.

(cherry picked from commit ac889684c78bc54fc537a0d97b12ddd13c0b0267)

lib/dns/resolver.c

index 4f2e363b9936a937aee09af7f259007bc3d41730..e136a74266ffbbd346c57eee9327b776e5abc5d5 100644 (file)
@@ -2298,6 +2298,12 @@ cleanup_dispatch:
        }
 
 cleanup_query:
+       LOCK(&res->buckets[fctx->bucketnum].lock);
+       if (ISC_LINK_LINKED(query, link)) {
+               atomic_fetch_sub_release(&fctx->nqueries, 1);
+               ISC_LIST_UNLINK(fctx->queries, query, link);
+       }
+       UNLOCK(&res->buckets[fctx->bucketnum].lock);
 
        query->magic = 0;
        dns_message_detach(&query->rmessage);