07bda6
diff -up nfs-utils-2.3.3/utils/gssd/krb5_util.c.orig nfs-utils-2.3.3/utils/gssd/krb5_util.c
07bda6
--- nfs-utils-2.3.3/utils/gssd/krb5_util.c.orig	2021-07-22 15:27:27.728680553 -0400
07bda6
+++ nfs-utils-2.3.3/utils/gssd/krb5_util.c	2021-07-22 15:30:08.916979585 -0400
07bda6
@@ -165,18 +165,28 @@ static int gssd_get_single_krb5_cred(krb
07bda6
 static int query_krb5_ccache(const char* cred_cache, char **ret_princname,
07bda6
 		char **ret_realm);
07bda6
 
07bda6
-static void release_ple(krb5_context context, struct gssd_k5_kt_princ *ple)
07bda6
+static void release_ple_locked(krb5_context context,
07bda6
+			       struct gssd_k5_kt_princ *ple)
07bda6
 {
07bda6
 	if (--ple->refcount)
07bda6
 		return;
07bda6
 
07bda6
-	printerr(3, "freeing cached principal (ccname=%s, realm=%s)\n", ple->ccname, ple->realm);
07bda6
+	printerr(3, "freeing cached principal (ccname=%s, realm=%s)\n",
07bda6
+		 ple->ccname, ple->realm);
07bda6
 	krb5_free_principal(context, ple->princ);
07bda6
 	free(ple->ccname);
07bda6
 	free(ple->realm);
07bda6
 	free(ple);
07bda6
 }
07bda6
 
07bda6
+static void release_ple(krb5_context context, struct gssd_k5_kt_princ *ple)
07bda6
+{
07bda6
+	pthread_mutex_lock(&ple_lock);
07bda6
+	release_ple_locked(context, ple);
07bda6
+	pthread_mutex_unlock(&ple_lock);
07bda6
+}
07bda6
+
07bda6
+
07bda6
 /*
07bda6
  * Called from the scandir function to weed out potential krb5
07bda6
  * credentials cache files
07bda6
@@ -1396,7 +1406,7 @@ gssd_destroy_krb5_principals(int destroy
07bda6
 			}
07bda6
 		}
07bda6
 
07bda6
-		release_ple(context, ple);
07bda6
+		release_ple_locked(context, ple);
07bda6
 	}
07bda6
 	pthread_mutex_unlock(&ple_lock);
07bda6
 	krb5_free_context(context);