From: Ondřej Kuzník Date: Wed, 19 Jul 2023 16:04:48 +0000 (+0100) Subject: ITS#10083 Do not mess with a connection that's dying already X-Git-Tag: OPENLDAP_REL_ENG_2_5_17~53 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=399eac419156a8a6eb6c56cb2759f89613185d55;p=thirdparty%2Fopenldap.git ITS#10083 Do not mess with a connection that's dying already --- diff --git a/servers/lloadd/upstream.c b/servers/lloadd/upstream.c index 6824fa8a8a..5e64029387 100644 --- a/servers/lloadd/upstream.c +++ b/servers/lloadd/upstream.c @@ -118,17 +118,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; }