From: Aram Sargsyan Date: Thu, 2 Mar 2023 10:18:11 +0000 (+0000) Subject: catz: protect db_registered and db callback (un)registration with a lock X-Git-Tag: v9.19.11~4^2~4 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a87859f1fa05ce92e99acb2c12aae0245bc8e79e;p=thirdparty%2Fbind9.git catz: protect db_registered and db callback (un)registration with a lock Doing this to avoid a race between the 'dns__catz_update_cb()' and 'dns_catz_dbupdate_callback()' functions. --- diff --git a/lib/dns/catz.c b/lib/dns/catz.c index 60f690fbe14..f0f3d047717 100644 --- a/lib/dns/catz.c +++ b/lib/dns/catz.c @@ -2480,6 +2480,7 @@ final: * update callback in zone_startload or axfr_makedb, but we will * call onupdate() artificially so we can register the callback here. */ + LOCK(&catzs->lock); if (!oldcatz->db_registered) { result = dns_db_updatenotify_register( updb, dns_catz_dbupdate_callback, oldcatz->catzs); @@ -2487,6 +2488,7 @@ final: oldcatz->db_registered = true; } } + UNLOCK(&catzs->lock); exit: catz->updateresult = result;