]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Lock dispatch manager buffer_lock before accessing buffers;
authorMark Andrews <marka@isc.org>
Fri, 22 Nov 2019 01:55:03 +0000 (12:55 +1100)
committerMark Andrews <marka@isc.org>
Tue, 26 Nov 2019 00:53:19 +0000 (11:53 +1100)
Only test buffers for UDP dispatches.

(cherry picked from commit 011af4de71f54743e650746c9ab7db80d1636800)

lib/dns/dispatch.c

index 6b18c24ea861de090433f8dabe93bb7a3e301c90..03a4f4113c886252d2f848ce08ac9bf4136ec8c3 100644 (file)
@@ -1504,8 +1504,14 @@ startrecv(dns_dispatch_t *disp, dispsocket_t *dispsock) {
        if (disp->recv_pending != 0 && dispsock == NULL)
                return (ISC_R_SUCCESS);
 
-       if (disp->mgr->buffers >= disp->mgr->maxbuffers)
-               return (ISC_R_NOMEMORY);
+       if (disp->socktype == isc_sockettype_udp) {
+               LOCK(&disp->mgr->buffer_lock);
+               if (disp->mgr->buffers >= disp->mgr->maxbuffers) {
+                       UNLOCK(&disp->mgr->buffer_lock);
+                       return (ISC_R_NOMEMORY);
+               }
+               UNLOCK(&disp->mgr->buffer_lock);
+       }
 
        if ((disp->attributes & DNS_DISPATCHATTR_EXCLUSIVE) != 0 &&
            dispsock == NULL)