]> git.ipfire.org Git - thirdparty/openldap.git/commitdiff
ITS#8747 Avoid epoch recursion in connection_write_cb
authorOndřej Kuzník <ondra@mistotebe.net>
Fri, 8 Jan 2021 11:32:48 +0000 (05:32 -0600)
committerQuanah Gibson-Mount <quanah@openldap.org>
Mon, 10 May 2021 18:49:13 +0000 (18:49 +0000)
servers/lloadd/connection.c

index d5898ddb5869f208fc83b590acca9bd1340df6b1..fd1527f3e321c65efffe53b4cc8d5dcab400e9cb 100644 (file)
@@ -322,7 +322,10 @@ connection_write_cb( evutil_socket_t s, short what, void *arg )
         return;
     }
 
-    epoch = epoch_join();
+    /* If what == 0, we have a caller as opposed to being a callback */
+    if ( what ) {
+        epoch = epoch_join();
+    }
 
     checked_lock( &c->c_io_mutex );
     Debug( LDAP_DEBUG_CONNS, "connection_write_cb: "
@@ -369,7 +372,9 @@ connection_write_cb( evutil_socket_t s, short what, void *arg )
 
 done:
     RELEASE_REF( c, c_refcnt, c->c_destroy );
-    epoch_leave( epoch );
+    if ( what ) {
+        epoch_leave( epoch );
+    }
 }
 
 void