From: Emily Backes Date: Mon, 30 Sep 2013 22:14:22 +0000 (-0700) Subject: ITS#7712 Fix lock ordering in libldap abandon X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=85003d8a54e23d2f93f18c2e6c75d80fecb6f75a;p=openldap ITS#7712 Fix lock ordering in libldap abandon --- diff --git a/libraries/libldap/abandon.c b/libraries/libldap/abandon.c index ea492604b8..d999b073a1 100644 --- a/libraries/libldap/abandon.c +++ b/libraries/libldap/abandon.c @@ -279,9 +279,14 @@ start_again:; if ( lr != NULL ) { if ( sendabandon || lr->lr_status == LDAP_REQST_WRITING ) { + /* release ld_req_mutex while grabbing ld_conn_mutex to + * prevent deadlock. + */ + LDAP_MUTEX_UNLOCK( &ld->ld_req_mutex ); LDAP_MUTEX_LOCK( &ld->ld_conn_mutex ); ldap_free_connection( ld, lr->lr_conn, 0, 1 ); LDAP_MUTEX_UNLOCK( &ld->ld_conn_mutex ); + LDAP_MUTEX_LOCK( &ld->ld_req_mutex ); } if ( origid == msgid ) {