From: Artem Boldariev Date: Tue, 10 May 2022 16:46:12 +0000 (+0300) Subject: Fix an abort in DoH (client-side) when writing on closing sock X-Git-Tag: v9.19.2~22^2~1 X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=9abb00bb5f66c1d365fb0e69bc96fa2e49bd37cf;p=thirdparty%2Fbind9.git Fix an abort in DoH (client-side) when writing on closing sock The commit fixes a corner case in client-side DoH code, when a write attempt is done on a closing socket (session). The change ensures that the write call-back will be called with a proper error code (see failed_send_cb() call in client_httpsend()). --- diff --git a/lib/isc/netmgr/http.c b/lib/isc/netmgr/http.c index a787e2d3102..4cde316236c 100644 --- a/lib/isc/netmgr/http.c +++ b/lib/isc/netmgr/http.c @@ -1509,7 +1509,12 @@ client_send(isc_nmhandle_t *handle, const isc_region_t *region) { REQUIRE(region != NULL); REQUIRE(region->base != NULL); REQUIRE(region->length <= MAX_DNS_MESSAGE_SIZE); - REQUIRE(cstream != NULL); + + if (session->closed) { + return (ISC_R_CANCELED); + } + + INSIST(cstream != NULL); if (cstream->post) { /* POST */