From 5677a410e6c2d5df8c370352c13ed903f8561aa8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Kuzn=C3=ADk?= Date: Wed, 19 Jul 2023 17:04:48 +0100 Subject: [PATCH] ITS#10083 Do not mess with a connection that's dying already --- servers/lloadd/upstream.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/servers/lloadd/upstream.c b/servers/lloadd/upstream.c index 771858dff0..2784532243 100644 --- a/servers/lloadd/upstream.c +++ b/servers/lloadd/upstream.c @@ -139,17 +139,22 @@ static int handle_unsolicited( LloadConnection *c, BerElement *ber ) { CONNECTION_ASSERT_LOCKED(c); - if ( c->c_state != LLOAD_C_PREPARING ) { - c->c_state = LLOAD_C_CLOSING; + + assert( c->c_state != LLOAD_C_INVALID ); + if ( c->c_state == LLOAD_C_DYING ) { + CONNECTION_UNLOCK(c); + goto out; } + c->c_state = LLOAD_C_CLOSING; Debug( LDAP_DEBUG_STATS, "handle_unsolicited: " "teardown for upstream connection connid=%lu\n", c->c_connid ); CONNECTION_DESTROY(c); - ber_free( ber, 1 ); +out: + ber_free( ber, 1 ); return -1; }