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

Destroy query in killoldestquery under a lock.

Fixes a race between ns_client_killoldestquery and ns_client_endrequest -
killoldestquery takes a client from `recursing` list while endrequest
destroys client object, then killoldestquery works on a destroyed client
object. Prevent it by holding reclist lock while cancelling query.
This commit is contained in:
Witold Kręcicki
2020-03-03 10:09:17 +01:00
committed by Witold Krecicki
parent 4c0591574f
commit df3dbdff81

View File

@@ -170,13 +170,11 @@ ns_client_killoldestquery(ns_client_t *client) {
oldest = ISC_LIST_HEAD(client->manager->recursing);
if (oldest != NULL) {
ISC_LIST_UNLINK(client->manager->recursing, oldest, rlink);
UNLOCK(&client->manager->reclock);
ns_query_cancel(oldest);
ns_stats_increment(client->sctx->nsstats,
ns_statscounter_reclimitdropped);
} else {
UNLOCK(&client->manager->reclock);
}
UNLOCK(&client->manager->reclock);
}
void