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

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