From: Witold Kręcicki Date: Sat, 31 Oct 2020 20:08:53 +0000 (+0100) Subject: Fix improper closed connection handling in tcpdns. X-Git-Tag: v9.17.7~29^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3ab3d90de039a3f086bba9c25792e42dd1b4a614;p=thirdparty%2Fbind9.git Fix improper closed connection handling in tcpdns. If dnslisten_readcb gets a read callback it needs to verify that the outer socket wasn't closed in the meantime, and issue a CANCELED callback if it was. --- diff --git a/lib/isc/netmgr/tcpdns.c b/lib/isc/netmgr/tcpdns.c index 255c44fe2c3..f5df92c1056 100644 --- a/lib/isc/netmgr/tcpdns.c +++ b/lib/isc/netmgr/tcpdns.c @@ -259,6 +259,11 @@ dnslisten_readcb(isc_nmhandle_t *handle, isc_result_t eresult, REQUIRE(VALID_NMSOCK(dnssock)); REQUIRE(dnssock->tid == isc_nm_tid()); REQUIRE(VALID_NMHANDLE(handle)); + if (eresult == ISC_R_SUCCESS && + (!isc__nmsocket_active(dnssock) || dnssock->outerhandle == NULL)) + { + eresult = ISC_R_CANCELED; + } if (region == NULL || eresult != ISC_R_SUCCESS) { /* Connection closed */