From e4604b71d2b41de4e3bf22f07fdd3d324fdd0a7a Mon Sep 17 00:00:00 2001 From: Aram Sargsyan Date: Tue, 2 May 2023 12:24:34 +0000 Subject: [PATCH 1/2] dighost.c: don't call check_if_done() twice successively The check_if_done() function can pass control back out to dighost_shutdown() (which is part of dig.c, host.c, or nslookup.c), and calling that twice can cause unexpected problems, if it is not designed to be idempotent. Since cancel_lookup() calls check_if_done() implicitly, don't call check_if_done() again when 'next' is NULL. --- bin/dig/dighost.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/dig/dighost.c b/bin/dig/dighost.c index 55168fa699..d8323c6f66 100644 --- a/bin/dig/dighost.c +++ b/bin/dig/dighost.c @@ -3212,11 +3212,11 @@ udp_ready(isc_nmhandle_t *handle, isc_result_t eresult, void *arg) { if (next != NULL) { start_udp(next); + check_if_done(); } else { clear_current_lookup(); } - check_if_done(); return; } @@ -3609,11 +3609,11 @@ tcp_connected(isc_nmhandle_t *handle, isc_result_t eresult, void *arg) { if (next != NULL) { start_tcp(next); + check_if_done(); } else { clear_current_lookup(); } - check_if_done(); return; } From d71299121ef4d1307465333d99c66c11aa8eeb57 Mon Sep 17 00:00:00 2001 From: Aram Sargsyan Date: Tue, 2 May 2023 13:21:35 +0000 Subject: [PATCH 2/2] Add a CHANGES note for [GL #4039] --- CHANGES | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGES b/CHANGES index eac5a1a7c8..3a07a49898 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,7 @@ +6165. [bug] Fix a logic error in dighost.c which could call the + dighost_shutdown() callback twice and cause problems + if the callback function was not idempotent. [GL #4039] + 6164. [bug] Set the rndc idle read timeout back to 60 seconds, from the netmgr default of 30 seconds, in order to match the behavior of 9.16 and earlier. [GL #4046]