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

Merge branch '1469-lock-order-inversion-tcp-listening' into 'master'

Fix a potential lock-order-inversion in tcp listening code

Closes #1469

See merge request isc-projects/bind9!2737
This commit is contained in:
Witold Krecicki
2019-12-10 09:21:03 +00:00

View File

@@ -186,10 +186,13 @@ isc_nm_listentcp(isc_nm_t *mgr, isc_nmiface_t *iface,
isc__nm_put_ievent(mgr, ievent);
} else {
nsock->tid = isc_random_uniform(mgr->nworkers);
LOCK(&nsock->lock);
isc__nm_enqueue_ievent(&mgr->workers[nsock->tid],
(isc__netievent_t *) ievent);
WAIT(&nsock->cond, &nsock->lock);
LOCK(&nsock->lock);
while (!atomic_load(&nsock->listening)) {
WAIT(&nsock->cond, &nsock->lock);
}
UNLOCK(&nsock->lock);
}