]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
[master] fix dispatch.c shutdown race
authorEvan Hunt <each@isc.org>
Fri, 21 Apr 2017 00:41:37 +0000 (17:41 -0700)
committerEvan Hunt <each@isc.org>
Fri, 21 Apr 2017 00:41:37 +0000 (17:41 -0700)
4952. [bug] A race condition on shutdown could trigger an
assertion failure in dispatch.c. [RT #43822]

CHANGES
lib/dns/dispatch.c
lib/dns/include/dns/dispatch.h

diff --git a/CHANGES b/CHANGES
index 9f91f992eb2923c4bfe010c3fd13ed1b6186967b..50cadf5ec54e39ed7b5af25216cca5b5a70afb63 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,6 @@
+4952.  [bug]           A race condition on shutdown could trigger an
+                       assertion failure in dispatch.c. [RT #43822]
+
 4591.  [port]          Addressed some python 3 compatibility issues.
                        Thanks to Ville Skytta. [RT #44955] [RT #44956]
 
index d9554ac634fa14416b40f4f5b06c84166e12af31..4f668a102da94aef1f2dd32814f21adf4cbfbcb4 100644 (file)
@@ -3721,9 +3721,12 @@ dns_dispatch_importrecv(dns_dispatch_t *disp, isc_event_t *event) {
        REQUIRE((disp->attributes & DNS_DISPATCHATTR_NOLISTEN) != 0);
        REQUIRE(event != NULL);
 
-       sevent = (isc_socketevent_t *)event;
+       if ((disp->attributes & DNS_DISPATCHATTR_NOLISTEN) == 0)
+               return;
 
+       sevent = (isc_socketevent_t *)event;
        INSIST(sevent->n <= disp->mgr->buffersize);
+
        newsevent = (isc_socketevent_t *)
                    isc_event_allocate(disp->mgr->mctx, NULL,
                                      DNS_EVENT_IMPORTRECVDONE, udp_shrecv,
index 25533907494018807a6aa19cbcb9e9c89785e049..c62cad771659be2e373315ecb6748c1fdccecd6f 100644 (file)
@@ -533,6 +533,9 @@ dns_dispatch_importrecv(dns_dispatch_t *disp, isc_event_t *event);
  * shared between dispatchers and clients.  If the dispatcher fails to copy
  * or send the event, nothing happens.
  *
+ * If the attribute DNS_DISPATCHATTR_NOLISTEN is not set, then
+ * the dispatch is already handling a recv; return immediately.
+ *
  * Requires:
  *\li  disp is valid, and the attribute DNS_DISPATCHATTR_NOLISTEN is set.
  *     event != NULL