]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Handle ISC_R_SUCCESS on a deactivated response in udp_recv()
authorAram Sargsyan <aram@isc.org>
Wed, 27 Apr 2022 12:29:50 +0000 (12:29 +0000)
committerAram Sargsyan <aram@isc.org>
Wed, 27 Apr 2022 15:53:14 +0000 (15:53 +0000)
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.

lib/dns/dispatch.c

index 74df922623e11aa1e932b58ae61013797aa7be9a..d4de0f74049c38925abab0ed6c60154b6342abea 100644 (file)
@@ -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);