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