]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
2789. [bug] Fixed an INSIST in dispatch.c [RT #20576]
authorEvan Hunt <each@isc.org>
Wed, 25 Nov 2009 05:55:32 +0000 (05:55 +0000)
committerEvan Hunt <each@isc.org>
Wed, 25 Nov 2009 05:55:32 +0000 (05:55 +0000)
CHANGES
lib/dns/dispatch.c

diff --git a/CHANGES b/CHANGES
index 782a0d893cee49d2e3df521da285c9361eea15fc..363b22820aee125a68b5b0b72ed825224cdfde41 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,5 @@
+2789.   [bug]           Fixed an INSIST in dispatch.c [RT #20576]
+
 2788.  [bug]           dnssec-signzone could sign with keys that were
                        not requested [RT #20625]
 
index e13230557eaf3494808e21699e53a8e421a1fa43..947a48e97f52caf49332fbbd941e6b1614068fd5 100644 (file)
@@ -15,7 +15,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: dispatch.c,v 1.164 2009/09/01 00:22:26 jinmei Exp $ */
+/* $Id: dispatch.c,v 1.165 2009/11/25 05:55:32 each Exp $ */
 
 /*! \file */
 
@@ -778,6 +778,9 @@ new_portentry(dns_dispatch_t *disp, in_port_t port) {
        return (portentry);
 }
 
+/*%
+ * The caller must not hold the qid->lock.
+ */
 static void
 deref_portentry(dns_dispatch_t *disp, dispportentry_t **portentryp) {
        dispportentry_t *portentry = *portentryp;
@@ -785,6 +788,9 @@ deref_portentry(dns_dispatch_t *disp, dispportentry_t **portentryp) {
        REQUIRE(disp->port_table != NULL);
        REQUIRE(portentry != NULL && portentry->refs > 0);
 
+       dns_qid_t *qid;
+       qid = DNS_QID(disp);
+       LOCK(&qid->lock);
        portentry->refs--;
        if (portentry->refs == 0) {
                ISC_LIST_UNLINK(disp->port_table[portentry->port %
@@ -794,6 +800,7 @@ deref_portentry(dns_dispatch_t *disp, dispportentry_t **portentryp) {
        }
 
        *portentryp = NULL;
+       UNLOCK(&qid->lock);
 }
 
 /*%
@@ -811,8 +818,9 @@ socket_search(dns_qid_t *qid, isc_sockaddr_t *dest, in_port_t port,
        dispsock = ISC_LIST_HEAD(qid->sock_table[bucket]);
 
        while (dispsock != NULL) {
-               if (isc_sockaddr_equal(dest, &dispsock->host) &&
-                   dispsock->portentry->port == port)
+                if (dispsock->portentry != NULL &&
+                   dispsock->portentry->port == port &&
+                   isc_sockaddr_equal(dest, &dispsock->host))
                        return (dispsock);
                dispsock = ISC_LIST_NEXT(dispsock, blink);
        }