Blame SOURCES/autofs-5.1.0-add-return-check-in-ldap-check_map_indirect.patch

304803
autofs-5.1.0 - add return check in ldap check_map_indirect()
304803
304803
From: Ian Kent <ikent@redhat.com>
304803
304803
Fix not checking return from pthread_mutex_lock/pthread_mutex_unlock in
304803
modules/lookup_ldap.c:check_map_indirect().
304803
---
304803
 CHANGELOG             |    1 +
304803
 modules/lookup_ldap.c |   17 +++++++++++++----
304803
 2 files changed, 14 insertions(+), 4 deletions(-)
304803
304803
--- autofs-5.0.7.orig/CHANGELOG
304803
+++ autofs-5.0.7/CHANGELOG
304803
@@ -139,6 +139,7 @@
304803
 - fix leak in get_network_proximity().
304803
 - fix buffer size checks in merge_options().
304803
 - check amd lex buffer len before copy.
304803
+- add return check in ldap check_map_indirect().
304803
 
304803
 25/07/2012 autofs-5.0.7
304803
 =======================
304803
--- autofs-5.0.7.orig/modules/lookup_ldap.c
304803
+++ autofs-5.0.7/modules/lookup_ldap.c
304803
@@ -3420,12 +3420,15 @@ static int check_map_indirect(struct aut
304803
 	time_t now = time(NULL);
304803
 	time_t t_last_read;
304803
 	int ret, cur_state;
304803
+	int status;
304803
 
304803
 	mc = source->mc;
304803
 
304803
 	pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &cur_state);
304803
 
304803
-	pthread_mutex_lock(&ap->entry->current_mutex);
304803
+	status = pthread_mutex_lock(&ap->entry->current_mutex);
304803
+	if (status)
304803
+		fatal(status);
304803
 	if (is_amd_format) {
304803
 		unsigned long timestamp = get_amd_timestamp(ctxt);
304803
 		if (timestamp > ctxt->timestamp) {
304803
@@ -3445,7 +3448,9 @@ static int check_map_indirect(struct aut
304803
 				ctxt->check_defaults = 0;
304803
 		}
304803
 	}
304803
-	pthread_mutex_unlock(&ap->entry->current_mutex);
304803
+	status = pthread_mutex_unlock(&ap->entry->current_mutex);
304803
+	if (status)
304803
+		fatal(status);
304803
 
304803
 	ret = match_key(ap, source, key, key_len, ctxt);
304803
 	if (ret == CHE_FAIL) {
304803
@@ -3490,10 +3495,14 @@ static int check_map_indirect(struct aut
304803
 		}
304803
 		cache_unlock(mc);
304803
 
304803
-		pthread_mutex_lock(&ap->entry->current_mutex);
304803
+		status = pthread_mutex_lock(&ap->entry->current_mutex);
304803
+		if (status)
304803
+			fatal(status);
304803
 		if (t_last_read > ap->exp_runfreq && ret & CHE_UPDATED)
304803
 			source->stale = 1;
304803
-		pthread_mutex_unlock(&ap->entry->current_mutex);
304803
+		status = pthread_mutex_unlock(&ap->entry->current_mutex);
304803
+		if (status)
304803
+			fatal(status);
304803
 	}
304803
 
304803
 	cache_readlock(mc);