|
|
1a4de8 |
From 312bd133f75c54d51196060c573e29aabbb0b842 Mon Sep 17 00:00:00 2001
|
|
|
1a4de8 |
From: Mark Andrews <marka@isc.org>
|
|
|
1a4de8 |
Date: Tue, 26 Nov 2019 02:30:14 +0000
|
|
|
1a4de8 |
Subject: [PATCH 1/4] Merge branch
|
|
|
1a4de8 |
'1367-threadsanitizer-data-race-dispatch-c-901-in-free_buffer-v9_11' into
|
|
|
1a4de8 |
'v9_11'
|
|
|
1a4de8 |
|
|
|
1a4de8 |
Resolve "ThreadSanitizer: data race dispatch.c:901 in free_buffer"
|
|
|
1a4de8 |
|
|
|
1a4de8 |
See merge request isc-projects/bind9!2628
|
|
|
1a4de8 |
|
|
|
1a4de8 |
(cherry picked from commit 0455351802cb915e7961dad9cf14977a19162d38)
|
|
|
1a4de8 |
---
|
|
|
1a4de8 |
lib/dns/dispatch.c | 9 ++++++---
|
|
|
1a4de8 |
1 file changed, 6 insertions(+), 3 deletions(-)
|
|
|
1a4de8 |
|
|
|
1a4de8 |
diff --git a/lib/dns/dispatch.c b/lib/dns/dispatch.c
|
|
|
1a4de8 |
index 3278db4a07..ea5cf102f2 100644
|
|
|
1a4de8 |
--- a/lib/dns/dispatch.c
|
|
|
1a4de8 |
+++ b/lib/dns/dispatch.c
|
|
|
1a4de8 |
@@ -927,6 +927,10 @@ allocate_udp_buffer(dns_dispatch_t *disp) {
|
|
|
1a4de8 |
void *temp;
|
|
|
1a4de8 |
|
|
|
1a4de8 |
LOCK(&disp->mgr->buffer_lock);
|
|
|
1a4de8 |
+ if (disp->mgr->buffers >= disp->mgr->maxbuffers) {
|
|
|
1a4de8 |
+ UNLOCK(&disp->mgr->buffer_lock);
|
|
|
1a4de8 |
+ return (NULL);
|
|
|
1a4de8 |
+ }
|
|
|
1a4de8 |
bpool = disp->mgr->bpool;
|
|
|
1a4de8 |
disp->mgr->buffers++;
|
|
|
1a4de8 |
UNLOCK(&disp->mgr->buffer_lock);
|
|
|
1a4de8 |
@@ -1058,9 +1062,11 @@ udp_recv(isc_event_t *ev_in, dns_dispatch_t *disp, dispsocket_t *dispsock) {
|
|
|
1a4de8 |
mgr = disp->mgr;
|
|
|
1a4de8 |
qid = mgr->qid;
|
|
|
1a4de8 |
|
|
|
1a4de8 |
+ LOCK(&disp->mgr->buffer_lock);
|
|
|
1a4de8 |
dispatch_log(disp, LVL(90),
|
|
|
1a4de8 |
"got packet: requests %d, buffers %d, recvs %d",
|
|
|
1a4de8 |
disp->requests, disp->mgr->buffers, disp->recv_pending);
|
|
|
1a4de8 |
+ UNLOCK(&disp->mgr->buffer_lock);
|
|
|
1a4de8 |
|
|
|
1a4de8 |
if (dispsock == NULL && ev->ev_type == ISC_SOCKEVENT_RECVDONE) {
|
|
|
1a4de8 |
/*
|
|
|
1a4de8 |
@@ -1511,9 +1517,6 @@ startrecv(dns_dispatch_t *disp, dispsocket_t *dispsock) {
|
|
|
1a4de8 |
if (disp->recv_pending != 0 && dispsock == NULL)
|
|
|
1a4de8 |
return (ISC_R_SUCCESS);
|
|
|
1a4de8 |
|
|
|
1a4de8 |
- if (disp->mgr->buffers >= disp->mgr->maxbuffers)
|
|
|
1a4de8 |
- return (ISC_R_NOMEMORY);
|
|
|
1a4de8 |
-
|
|
|
1a4de8 |
if ((disp->attributes & DNS_DISPATCHATTR_EXCLUSIVE) != 0 &&
|
|
|
1a4de8 |
dispsock == NULL)
|
|
|
1a4de8 |
return (ISC_R_SUCCESS);
|
|
|
1a4de8 |
--
|
|
|
1a4de8 |
2.21.0
|
|
|
1a4de8 |
|