]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Fix improper closed connection handling in tcpdns.
authorWitold Kręcicki <wpk@isc.org>
Sat, 31 Oct 2020 20:08:53 +0000 (21:08 +0100)
committerOndřej Surý <ondrej@sury.org>
Mon, 2 Nov 2020 14:10:28 +0000 (15:10 +0100)
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.

lib/isc/netmgr/tcpdns.c

index 255c44fe2c3b6e0544a671d5e8a60a838ece13da..f5df92c10564b9d60f0fe63532a045f98c1f2632 100644 (file)
@@ -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 */