mirror of
https://github.com/isc-projects/bind9.git
synced 2026-05-28 04:34:54 -04:00
Add shutdown checks in dns_catz_dbupdate_callback()
When a zone database update callback is called, the 'catzs' object,
extracted from the callback argument, might be already shutting down,
in which case the 'catzs->zones' can be NULL and cause an assertion
failure when calling isc_ht_find().
Add an early return from the callback if 'catzs->shuttingdown' is true.
Also check the validity of 'catzs->zones' after locking 'catzs' in
case there is a race with dns_catz_shutdown_catzs() running in another
thread.
(cherry picked from commit 28bb419edc)
This commit is contained in:
parent
e1529a6a01
commit
4fdb57a1f3
1 changed files with 8 additions and 0 deletions
|
|
@ -2137,9 +2137,17 @@ dns_catz_dbupdate_callback(dns_db_t *db, void *fn_arg) {
|
|||
REQUIRE(DNS_DB_VALID(db));
|
||||
REQUIRE(DNS_CATZ_ZONES_VALID(catzs));
|
||||
|
||||
if (atomic_load(&catzs->shuttingdown)) {
|
||||
return (ISC_R_SHUTTINGDOWN);
|
||||
}
|
||||
|
||||
dns_name_toregion(&db->origin, &r);
|
||||
|
||||
LOCK(&catzs->lock);
|
||||
if (catzs->zones == NULL) {
|
||||
result = ISC_R_SHUTTINGDOWN;
|
||||
goto cleanup;
|
||||
}
|
||||
result = isc_ht_find(catzs->zones, r.base, r.length, (void **)&catz);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
goto cleanup;
|
||||
|
|
|
|||
Loading…
Reference in a new issue