]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
catz: protect db_registered and db callback (un)registration with a lock
authorAram Sargsyan <aram@isc.org>
Thu, 2 Mar 2023 10:18:11 +0000 (10:18 +0000)
committerAram Sargsyan <aram@isc.org>
Thu, 2 Mar 2023 18:57:16 +0000 (18:57 +0000)
Doing this to avoid a race between the 'dns__catz_update_cb()' and
'dns_catz_dbupdate_callback()' functions.

(cherry picked from commit a87859f1fa05ce92e99acb2c12aae0245bc8e79e)

lib/dns/catz.c

index 909b8a102ce4e2ec3c996badbab204e9f1be3b8c..30722db30702d5f8809b28efe03fcad9246dd33b 100644 (file)
@@ -2500,6 +2500,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);
@@ -2507,6 +2508,7 @@ final:
                        oldcatz->db_registered = true;
                }
        }
+       UNLOCK(&catzs->lock);
 
 exit:
        catz->updateresult = result;