]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
4228. [bug] Address race condition in dns_client_destroyrestrans.
authorMark Andrews <marka@isc.org>
Wed, 30 Sep 2015 04:58:31 +0000 (14:58 +1000)
committerMark Andrews <marka@isc.org>
Wed, 30 Sep 2015 04:58:31 +0000 (14:58 +1000)
                        [RT #40605]

CHANGES
lib/dns/client.c

diff --git a/CHANGES b/CHANGES
index 773daf5f493e5f64d732b7d578bed66ad4be5659..65e1f290e098cbd4caa9ed1c38398017cfcbb753 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,6 @@
+4228.  [bug]           Address race condition in dns_client_destroyrestrans.
+                       [RT #40605]
+
 4227.  [bug]           Silence static analysis warnings. [RT #40828]
 
 4226.  [bug]           Address a theoretical shutdown race in
index c150fd19e8f5a1e46617e66ffa126e69f64cf921..394a6d0fd09d334ff571c469ec4019381073ec74 100644 (file)
@@ -1178,7 +1178,6 @@ client_resfind(resctx_t *rctx, dns_fetchevent_t *event) {
        UNLOCK(&rctx->lock);
 }
 
-
 static void
 suspend(isc_task_t *task, isc_event_t *event) {
        isc_appctx_t *actx = event->ev_arg;
@@ -1498,6 +1497,13 @@ dns_client_destroyrestrans(dns_clientrestrans_t **transp) {
        mctx = client->mctx;
        dns_view_detach(&rctx->view);
 
+       /*
+        * Wait for the lock in client_resfind to be released before
+        * destroying the lock.
+        */
+       LOCK(&rctx->lock);
+       UNLOCK(&rctx->lock);
+
        LOCK(&client->lock);
 
        INSIST(ISC_LINK_LINKED(rctx, link));