From: Witold Kręcicki Date: Tue, 30 Oct 2018 07:09:58 +0000 (+0000) Subject: Destroy task first when destroying rpzs. X-Git-Tag: v9.13.4~69^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=541872bf3b1d7d5d30a2aaeb0d19f36829711161;p=thirdparty%2Fbind9.git 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. --- diff --git a/lib/dns/rpz.c b/lib/dns/rpz.c index 38fd3bd2cdf..00751923e2b 100644 --- a/lib/dns/rpz.c +++ b/lib/dns/rpz.c @@ -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)); } }