From: Mark Andrews Date: Fri, 22 Nov 2019 01:55:03 +0000 (+1100) Subject: Lock dispatch manager buffer_lock before accessing buffers; X-Git-Tag: v9.15.7~70^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=011af4de71f54743e650746c9ab7db80d1636800;p=thirdparty%2Fbind9.git Lock dispatch manager buffer_lock before accessing buffers; Only test buffers for UDP dispatches. --- diff --git a/lib/dns/dispatch.c b/lib/dns/dispatch.c index 6cd2fd7fe35..2e534d26c3b 100644 --- a/lib/dns/dispatch.c +++ b/lib/dns/dispatch.c @@ -1500,8 +1500,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)