]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Fix a shutdown race in bin/dig/dighost.c
authorMichał Kępień <michal@isc.org>
Tue, 13 Nov 2018 12:50:47 +0000 (13:50 +0100)
committerMichał Kępień <michal@isc.org>
Tue, 13 Nov 2018 12:50:47 +0000 (13:50 +0100)
If a tool using the routines defined in bin/dig/dighost.c is sent an
interruption signal around the time a connection timeout is scheduled to
fire, connect_timeout() may be executed after destroy_libs() detaches
from the global task (setting 'global_task' to NULL), which results in a
crash upon a UDP retry due to bringup_timer() attempting to create a
timer with 'task' set to NULL.  Fix by preventing connect_timeout() from
attempting a retry when shutdown is in progress.

bin/dig/dighost.c

index f4e5e55ae6e95a4107a227ac37ddf78c4dbff0f0..410b63435b1a2c611732bbe90ea807da40cb349d 100644 (file)
@@ -2902,6 +2902,11 @@ connect_timeout(isc_task_t *task, isc_event_t *event) {
 
        INSIST(!free_now);
 
+       if (cancel_now) {
+               UNLOCK_LOOKUP;
+               return;
+       }
+
        if ((query != NULL) && (query->lookup->current_query != NULL) &&
            ISC_LINK_LINKED(query->lookup->current_query, link) &&
            (ISC_LIST_NEXT(query->lookup->current_query, link) != NULL)) {