mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-29 13:38:26 +00:00
named crashes on shutdown after load rpz failed
This may happen when loading an RPZ failed and the code path skips calling dns_db_endload(). The dns_rpz_zone_t object is still kept marked as having registered db. So when this object is finally destroyed in rpz_detach(), this code will incorrectly call `dns_db_updatenotify_unregister()`: if (rpz->db_registered) dns_db_updatenotify_unregister(rpz->db, dns_rpz_dbupdate_callback, rpz); and trigger this assertion failure: REQUIRE(db != NULL); To fix this, only call `dns_db_updatenotify_unregister()` when `rpz->db` is not NULL.
This commit is contained in:
parent
8d392f9093
commit
a490c09121
@ -1586,7 +1586,6 @@ dns_rpz_dbupdate_callback(dns_db_t *db, void *fn_arg) {
|
|||||||
LOCK(&zone->rpzs->maint_lock);
|
LOCK(&zone->rpzs->maint_lock);
|
||||||
REQUIRE(zone->db_registered);
|
REQUIRE(zone->db_registered);
|
||||||
|
|
||||||
|
|
||||||
/* New zone came as AXFR */
|
/* New zone came as AXFR */
|
||||||
if (zone->db != NULL && zone->db != db) {
|
if (zone->db != NULL && zone->db != db) {
|
||||||
/* We need to clean up the old DB */
|
/* We need to clean up the old DB */
|
||||||
@ -2097,14 +2096,14 @@ rpz_detach(dns_rpz_zone_t **rpzp, dns_rpz_zones_t *rpzs) {
|
|||||||
if (dns_name_dynamic(&rpz->cname)) {
|
if (dns_name_dynamic(&rpz->cname)) {
|
||||||
dns_name_free(&rpz->cname, rpzs->mctx);
|
dns_name_free(&rpz->cname, rpzs->mctx);
|
||||||
}
|
}
|
||||||
if (rpz->db_registered) {
|
|
||||||
dns_db_updatenotify_unregister(rpz->db,
|
|
||||||
dns_rpz_dbupdate_callback, rpz);
|
|
||||||
}
|
|
||||||
if (rpz->dbversion != NULL) {
|
if (rpz->dbversion != NULL) {
|
||||||
dns_db_closeversion(rpz->db, &rpz->dbversion, false);
|
dns_db_closeversion(rpz->db, &rpz->dbversion, false);
|
||||||
}
|
}
|
||||||
if (rpz->db != NULL) {
|
if (rpz->db != NULL) {
|
||||||
|
if (rpz->db_registered) {
|
||||||
|
dns_db_updatenotify_unregister(
|
||||||
|
rpz->db, dns_rpz_dbupdate_callback, rpz);
|
||||||
|
}
|
||||||
dns_db_detach(&rpz->db);
|
dns_db_detach(&rpz->db);
|
||||||
}
|
}
|
||||||
if (rpz->updaterunning) {
|
if (rpz->updaterunning) {
|
||||||
|
@ -2120,7 +2120,7 @@ zone_load(dns_zone_t *zone, unsigned int flags, bool locked) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! dns_db_ispersistent(db)) {
|
if (!dns_db_ispersistent(db)) {
|
||||||
if (zone->masterfile != NULL) {
|
if (zone->masterfile != NULL) {
|
||||||
result = zone_startload(db, zone, loadtime);
|
result = zone_startload(db, zone, loadtime);
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user