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

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