]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
1576. [bug] Race condition in dns_dispatch_addresponse().
authorMark Andrews <marka@isc.org>
Tue, 10 Feb 2004 06:11:17 +0000 (06:11 +0000)
committerMark Andrews <marka@isc.org>
Tue, 10 Feb 2004 06:11:17 +0000 (06:11 +0000)
                        [RT# 10272]

CHANGES
lib/dns/dispatch.c

diff --git a/CHANGES b/CHANGES
index a14fe81c6263f5a0f6198d431a01873a6255fec1..f086dce8ddfc715a424c9c1faa212ec6c05fc93f 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,4 +1,5 @@
-1576.  [placeholder]   rt10272
+1576.  [bug]           Race condition in dns_dispatch_addresponse().
+                       [RT# 10272]
 
 1575.  [func]          Log TSIG name on TSIG verify failure. [RT #4404]
 
index 848202a3130ec95e5bb716d2c5e2160311bebc64..03b4f0f029b7cfd8087e83266625c28b28960afe 100644 (file)
@@ -15,7 +15,7 @@
  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: dispatch.c,v 1.114 2004/02/03 00:59:04 marka Exp $ */
+/* $Id: dispatch.c,v 1.115 2004/02/10 06:11:17 marka Exp $ */
 
 #include <config.h>
 
@@ -1864,15 +1864,16 @@ dns_dispatch_addresponse(dns_dispatch_t *disp, isc_sockaddr_t *dest,
                id &= 0x0000ffff;
                bucket = dns_hash(qid, dest, id);
        }
-       UNLOCK(&qid->lock);
 
        if (!ok) {
+               UNLOCK(&qid->lock);
                UNLOCK(&disp->lock);
                return (ISC_R_NOMORE);
        }
 
        res = isc_mempool_get(disp->mgr->rpool);
        if (res == NULL) {
+               UNLOCK(&qid->lock);
                UNLOCK(&disp->lock);
                return (ISC_R_NOMEMORY);
        }
@@ -1891,7 +1892,6 @@ dns_dispatch_addresponse(dns_dispatch_t *disp, isc_sockaddr_t *dest,
        ISC_LIST_INIT(res->items);
        ISC_LINK_INIT(res, link);
        res->magic = RESPONSE_MAGIC;
-       LOCK(&qid->lock);
        ISC_LIST_APPEND(qid->qid_table[bucket], res, link);
        UNLOCK(&qid->lock);