mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-29 13:38:26 +00:00
Fix a potential lock-order-inversion in tcp listening code
This commit is contained in:
parent
01481dee1c
commit
ccd44b69e5
@ -186,10 +186,13 @@ isc_nm_listentcp(isc_nm_t *mgr, isc_nmiface_t *iface,
|
|||||||
isc__nm_put_ievent(mgr, ievent);
|
isc__nm_put_ievent(mgr, ievent);
|
||||||
} else {
|
} else {
|
||||||
nsock->tid = isc_random_uniform(mgr->nworkers);
|
nsock->tid = isc_random_uniform(mgr->nworkers);
|
||||||
LOCK(&nsock->lock);
|
|
||||||
isc__nm_enqueue_ievent(&mgr->workers[nsock->tid],
|
isc__nm_enqueue_ievent(&mgr->workers[nsock->tid],
|
||||||
(isc__netievent_t *) ievent);
|
(isc__netievent_t *) ievent);
|
||||||
|
|
||||||
|
LOCK(&nsock->lock);
|
||||||
|
while (!atomic_load(&nsock->listening)) {
|
||||||
WAIT(&nsock->cond, &nsock->lock);
|
WAIT(&nsock->cond, &nsock->lock);
|
||||||
|
}
|
||||||
UNLOCK(&nsock->lock);
|
UNLOCK(&nsock->lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user