From 85003d8a54e23d2f93f18c2e6c75d80fecb6f75a Mon Sep 17 00:00:00 2001 From: Emily Backes Date: Mon, 30 Sep 2013 15:14:22 -0700 Subject: [PATCH] ITS#7712 Fix lock ordering in libldap abandon --- libraries/libldap/abandon.c | 5 +++++ 1 file changed, 5 insertions(+) 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 ) { -- 2.39.5