]> 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 17:40:10 +0000 (17:40 +0000)
Doing this to avoid a race between the 'dns__catz_update_cb()' and
'dns_catz_dbupdate_callback()' functions.

lib/dns/catz.c

index 60f690fbe145b2678e22e55a933539fa9d72f191..f0f3d0477170e9bfb0dd73a179a7e8f132b6fd10 100644 (file)
@@ -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;