]> git.ipfire.org Git - thirdparty/openldap.git/commitdiff
ITS#10083 Do not mess with a connection that's dying already
authorOndřej Kuzník <ondra@mistotebe.net>
Wed, 19 Jul 2023 16:04:48 +0000 (17:04 +0100)
committerQuanah Gibson-Mount <quanah@openldap.org>
Mon, 9 Oct 2023 20:29:15 +0000 (20:29 +0000)
servers/lloadd/upstream.c

index 6824fa8a8ad46393581b6c6ab8ad31ba3802275e..5e6402938757373b00cfca08a5cec80d472cf384 100644 (file)
@@ -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;
 }