From 91c79af4755df2d892511512e0fc886639518a92 Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Tue, 10 Feb 2004 06:11:17 +0000 Subject: [PATCH] 1576. [bug] Race condition in dns_dispatch_addresponse(). [RT# 10272] --- CHANGES | 3 ++- lib/dns/dispatch.c | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/CHANGES b/CHANGES index a14fe81c62..f086dce8dd 100644 --- a/CHANGES +++ b/CHANGES @@ -1,4 +1,5 @@ -1576. [placeholder] rt10272 +1576. [bug] Race condition in dns_dispatch_addresponse(). + [RT# 10272] 1575. [func] Log TSIG name on TSIG verify failure. [RT #4404] diff --git a/lib/dns/dispatch.c b/lib/dns/dispatch.c index 848202a313..03b4f0f029 100644 --- a/lib/dns/dispatch.c +++ b/lib/dns/dispatch.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: dispatch.c,v 1.114 2004/02/03 00:59:04 marka Exp $ */ +/* $Id: dispatch.c,v 1.115 2004/02/10 06:11:17 marka Exp $ */ #include @@ -1864,15 +1864,16 @@ dns_dispatch_addresponse(dns_dispatch_t *disp, isc_sockaddr_t *dest, id &= 0x0000ffff; bucket = dns_hash(qid, dest, id); } - UNLOCK(&qid->lock); if (!ok) { + UNLOCK(&qid->lock); UNLOCK(&disp->lock); return (ISC_R_NOMORE); } res = isc_mempool_get(disp->mgr->rpool); if (res == NULL) { + UNLOCK(&qid->lock); UNLOCK(&disp->lock); return (ISC_R_NOMEMORY); } @@ -1891,7 +1892,6 @@ dns_dispatch_addresponse(dns_dispatch_t *disp, isc_sockaddr_t *dest, ISC_LIST_INIT(res->items); ISC_LINK_INIT(res, link); res->magic = RESPONSE_MAGIC; - LOCK(&qid->lock); ISC_LIST_APPEND(qid->qid_table[bucket], res, link); UNLOCK(&qid->lock);