From: Michał Kępień Date: Tue, 13 Nov 2018 12:50:47 +0000 (+0100) Subject: Fix a shutdown race in bin/dig/dighost.c X-Git-Tag: v9.13.4~33^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=462175659674a10c0d39c7c328f1a5324ce2e38b;p=thirdparty%2Fbind9.git Fix a shutdown race in bin/dig/dighost.c 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. --- diff --git a/bin/dig/dighost.c b/bin/dig/dighost.c index f4e5e55ae6e..410b63435b1 100644 --- a/bin/dig/dighost.c +++ b/bin/dig/dighost.c @@ -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)) {