From 4de1f65e4d4a0be24229057f632ccf08112231e1 Mon Sep 17 00:00:00 2001 From: Aram Sargsyan Date: Wed, 27 Apr 2022 12:29:50 +0000 Subject: [PATCH 1/2] Handle ISC_R_SUCCESS on a deactivated response in udp_recv() There is a possibility for `udp_recv()` to be called with `eresult` being `ISC_R_SUCCESS`, but nevertheless with already deactivated `resp`, which can happen when the request has been canceled in the meantime. (cherry picked from commit e3a88862c0e0a7b9a58727b321ff1424e003fc4d) --- lib/dns/dispatch.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/dns/dispatch.c b/lib/dns/dispatch.c index 7544a4dba2..ce605f0c6c 100644 --- a/lib/dns/dispatch.c +++ b/lib/dns/dispatch.c @@ -491,6 +491,8 @@ udp_recv(isc_nmhandle_t *handle, isc_result_t eresult, isc_region_t *region, */ if (ISC_LINK_LINKED(resp, alink)) { response = resp->response; + } else if (eresult == ISC_R_SUCCESS) { + eresult = ISC_R_CANCELED; } if (eresult != ISC_R_SUCCESS) { @@ -503,8 +505,6 @@ udp_recv(isc_nmhandle_t *handle, isc_result_t eresult, isc_region_t *region, goto done; } - INSIST(ISC_LINK_LINKED(resp, alink)); - peer = isc_nmhandle_peeraddr(handle); isc_netaddr_fromsockaddr(&netaddr, &peer); From e1aca8d57551c6420ba7d134e0e4b5e792328857 Mon Sep 17 00:00:00 2001 From: Aram Sargsyan Date: Wed, 27 Apr 2022 12:48:57 +0000 Subject: [PATCH 2/2] Add CHANGES note for [GL #3300] (cherry picked from commit bbdd139e2086b7105d67154659b1147074e46b8b) --- CHANGES | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGES b/CHANGES index 29506fb8aa..01b269a053 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,7 @@ +5872. [bug] udp_recv() in dispatch could trigger an INSIST when the + callback's result indicated success but the response + was canceled in the meantime. [GL #3300] + 5866. [bug] Work around a jemalloc quirk which could trigger an out-of-memory condition in named over time. [GL #3287]