From: Ondřej Surý Date: Tue, 19 Nov 2019 05:49:28 +0000 (+0800) Subject: Fix missing adb->{e,i}refcnt locking X-Git-Tag: v9.15.7~64^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=21eab267dfdcbfc46a65025697837aa214a75972;p=thirdparty%2Fbind9.git Fix missing adb->{e,i}refcnt locking --- diff --git a/lib/dns/adb.c b/lib/dns/adb.c index d07dcd36ad5..94ce4d418fc 100644 --- a/lib/dns/adb.c +++ b/lib/dns/adb.c @@ -2785,9 +2785,8 @@ dns_adb_detach(dns_adb_t **adbx) { adb = *adbx; *adbx = NULL; - INSIST(adb->erefcnt > 0); - LOCK(&adb->reflock); + INSIST(adb->erefcnt > 0); adb->erefcnt--; need_exit_check = (adb->erefcnt == 0 && adb->irefcnt == 0); UNLOCK(&adb->reflock); @@ -3393,10 +3392,13 @@ dump_adb(dns_adb_t *adb, FILE *f, bool debug, isc_stdtime_t now) { fprintf(f, "; [edns success/4096 timeout/1432 timeout/1232 timeout/" "512 timeout]\n"); fprintf(f, "; [plain success/timeout]\n;\n"); - if (debug) + if (debug) { + LOCK(&adb->reflock); fprintf(f, "; addr %p, erefcnt %u, irefcnt %u, finds out %u\n", adb, adb->erefcnt, adb->irefcnt, isc_mempool_getallocated(adb->nhmp)); + UNLOCK(&adb->reflock); + } /* * In TSAN mode we need to lock the locks individually, as TSAN