2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-30 22:15:20 +00:00

Merge branch '2636-timing-race-in-setnsec3param-task' into 'main'

Fix task timing race in setnsec3param()

Closes #2636

See merge request isc-projects/bind9!4908
This commit is contained in:
Ondřej Surý
2021-04-19 09:22:31 +00:00

View File

@@ -21119,6 +21119,22 @@ setnsec3param(isc_task_t *task, isc_event_t *event) {
*/ */
ISC_LIST_APPEND(zone->rss_post, event, ev_link); ISC_LIST_APPEND(zone->rss_post, event, ev_link);
} else { } else {
bool rescheduled = false;
ZONEDB_LOCK(&zone->dblock, isc_rwlocktype_read);
/*
* The zone is not yet fully loaded. Reschedule the event to
* be picked up later. This turns this function into a busy
* wait, but it only happens at startup.
*/
if (zone->db == NULL) {
rescheduled = true;
isc_task_send(task, &event);
}
ZONEDB_UNLOCK(&zone->dblock, isc_rwlocktype_read);
if (rescheduled) {
return;
}
rss_post(zone, event); rss_post(zone, event);
} }
dns_zone_idetach(&zone); dns_zone_idetach(&zone);