mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-31 14:35:26 +00:00
Merge branch '4060-prevent-an-infinite-loop-in-shutdown_listener' into 'main'
Prevent an infinite loop in shutdown_listener() Closes #4060 See merge request isc-projects/bind9!8581
This commit is contained in:
@@ -202,15 +202,22 @@ ISC_REFCOUNT_IMPL(controlconnection, conn_free);
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
shutdown_listener(controllistener_t *listener) {
|
shutdown_listener(controllistener_t *listener) {
|
||||||
|
controlconnection_t *conn = NULL;
|
||||||
|
controlconnection_t *next = NULL;
|
||||||
|
|
||||||
/* Don't shutdown the same listener twice */
|
/* Don't shutdown the same listener twice */
|
||||||
if (listener->shuttingdown) {
|
if (listener->shuttingdown) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
listener->shuttingdown = true;
|
listener->shuttingdown = true;
|
||||||
|
|
||||||
for (controlconnection_t *conn = ISC_LIST_HEAD(listener->connections);
|
for (conn = ISC_LIST_HEAD(listener->connections); conn != NULL;
|
||||||
conn != NULL; conn = ISC_LIST_HEAD(listener->connections))
|
conn = next)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
|
* 'conn' is likely to be freed by the conn_shutdown() call.
|
||||||
|
*/
|
||||||
|
next = ISC_LIST_NEXT(conn, link);
|
||||||
conn_shutdown(conn);
|
conn_shutdown(conn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user