Blame SOURCES/autofs-5.1.8-avoid-calling-pthread_getspecific-with-NULL-key_thread_attempt_id.patch

91594d
autofs-5.1.8 - avoid calling pthread_getspecific() with NULL key_thread_attempt_id
91594d
91594d
From: Ian Kent <raven@themaw.net>
91594d
91594d
Don't call pthread_getspecific() if key_thread_attempt_id is NULL in
91594d
case the pthread_getspecific() implementation doesn't check for this.
91594d
91594d
Signed-off-by: Ian Kent <raven@themaw.net>
91594d
---
91594d
 CHANGELOG |    1 +
91594d
 lib/log.c |    3 +++
91594d
 2 files changed, 4 insertions(+)
91594d
91594d
--- autofs-5.1.7.orig/CHANGELOG
91594d
+++ autofs-5.1.7/CHANGELOG
91594d
@@ -92,6 +92,7 @@
91594d
 - simplify cache_add() a little.
91594d
 - fix use after free in tree_mapent_delete_offset_tree().
91594d
 - fix memory leak in xdr_exports().
91594d
+- avoid calling pthread_getspecific() with NULL key_thread_attempt_id.
91594d
 
91594d
 25/01/2021 autofs-5.1.7
91594d
 - make bind mounts propagation slave by default.
91594d
--- autofs-5.1.7.orig/lib/log.c
91594d
+++ autofs-5.1.7/lib/log.c
91594d
@@ -38,6 +38,9 @@ static char *prepare_attempt_prefix(cons
91594d
 	char buffer[ATTEMPT_ID_SIZE + 1];
91594d
 	char *prefixed_msg = NULL;
91594d
 
91594d
+	if (!key_thread_attempt_id)
91594d
+		return NULL;
91594d
+
91594d
 	attempt_id = pthread_getspecific(key_thread_attempt_id);
91594d
 	if (attempt_id) {
91594d
 		int len = sizeof(buffer) + 1 + strlen(msg) + 1;