mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-31 06:25:31 +00:00
Fix a shutdown race in netmgr udp
We need to mark the socket as inactive early (and synchronously) in the stoplistening process; otherwise we might destroy the callback argument before we actually stop listening, and call the callback on bad memory.
This commit is contained in:
committed by
Evan Hunt
parent
3704c4fff2
commit
1cf65cd882
@@ -833,10 +833,13 @@ nmsocket_maybe_destroy(isc_nmsocket_t *sock) {
|
||||
if (active_handles == 0 || sock->tcphandle != NULL) {
|
||||
destroy = true;
|
||||
}
|
||||
UNLOCK(&sock->lock);
|
||||
|
||||
if (destroy) {
|
||||
atomic_store(&sock->destroying, true);
|
||||
UNLOCK(&sock->lock);
|
||||
nmsocket_cleanup(sock, true);
|
||||
} else {
|
||||
UNLOCK(&sock->lock);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user