2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-30 22:15:20 +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:
Michał Kępień
2023-12-18 10:07:35 +00:00

View File

@@ -202,15 +202,22 @@ ISC_REFCOUNT_IMPL(controlconnection, conn_free);
static void
shutdown_listener(controllistener_t *listener) {
controlconnection_t *conn = NULL;
controlconnection_t *next = NULL;
/* Don't shutdown the same listener twice */
if (listener->shuttingdown) {
return;
}
listener->shuttingdown = true;
for (controlconnection_t *conn = ISC_LIST_HEAD(listener->connections);
conn != NULL; conn = ISC_LIST_HEAD(listener->connections))
for (conn = ISC_LIST_HEAD(listener->connections); conn != NULL;
conn = next)
{
/*
* 'conn' is likely to be freed by the conn_shutdown() call.
*/
next = ISC_LIST_NEXT(conn, link);
conn_shutdown(conn);
}