2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 14:35:26 +00:00

Destroy task first when destroying rpzs.

When freeing rpzs structures we need to kill the updater task first.
Otherwise we might race with the updater and there might be a crash
on shutdown.
This commit is contained in:
Witold Kręcicki
2018-10-30 07:09:58 +00:00
committed by Ondřej Surý
parent faa52a704f
commit 541872bf3b

View File

@@ -2148,7 +2148,12 @@ dns_rpz_detach_rpzs(dns_rpz_zones_t **rpzsp) {
*rpzsp = NULL;
if (isc_refcount_decrement(&rpzs->refs) == 1) {
isc_refcount_destroy(&rpzs->refs);
/*
* Destroy the task first, so that nothing runs
* in the background that might race with us.
*/
isc_task_destroy(&rpzs->updater);
/*
* Forget the last of view's rpz machinery after
* the last reference.
@@ -2178,7 +2183,7 @@ dns_rpz_detach_rpzs(dns_rpz_zones_t **rpzsp) {
}
DESTROYLOCK(&rpzs->maint_lock);
isc_rwlock_destroy(&rpzs->search_lock);
isc_task_destroy(&rpzs->updater);
isc_refcount_destroy(&rpzs->refs);
isc_mem_putanddetach(&rpzs->mctx, rpzs, sizeof(*rpzs));
}
}