Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-15-SP7:GA
nfs-utils.22533
0019-gssd-use-mutex-to-protect-decrement-of-ref...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0019-gssd-use-mutex-to-protect-decrement-of-refcount.patch of Package nfs-utils.22533
From e7a75f13bdf85fedc76ac345120006f74f4c316a Mon Sep 17 00:00:00 2001 From: NeilBrown <neilb@suse.de> Date: Fri, 21 May 2021 14:50:03 +1000 Subject: [PATCH] gssd: use mutex to protect decrement of refcount The decrement of the "ple" refcount is not protected so it can race with increments or decrements from other threads. An increment could be lost and then the ple would be freed early, leading to memory corruption. So use the mutex to protect decrements (increments are already protected). [Following applies upstream, but not to SLE15 As gssd_destroy_krb5_principals() calls release_ple() while holding the mutex, we need a "release_pte_locked()" which doesn't take the mutex. ] Signed-off-by: NeilBrown <neilb@suse.de> --- utils/gssd/krb5_util.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) --- a/utils/gssd/krb5_util.c +++ b/utils/gssd/krb5_util.c @@ -165,18 +165,28 @@ static int gssd_get_single_krb5_cred(krb static int query_krb5_ccache(const char* cred_cache, char **ret_princname, char **ret_realm); -static void release_ple(krb5_context context, struct gssd_k5_kt_princ *ple) +static void release_ple_locked(krb5_context context, + struct gssd_k5_kt_princ *ple) { if (--ple->refcount) return; - printerr(3, "freeing cached principal (ccname=%s, realm=%s)\n", ple->ccname, ple->realm); + printerr(3, "freeing cached principal (ccname=%s, realm=%s)\n", + ple->ccname, ple->realm); krb5_free_principal(context, ple->princ); free(ple->ccname); free(ple->realm); free(ple); } +static void release_ple(krb5_context context, struct gssd_k5_kt_princ *ple) +{ + pthread_mutex_lock(&ple_lock); + release_ple_locked(context, ple); + pthread_mutex_unlock(&ple_lock); +} + + /* * Called from the scandir function to weed out potential krb5 * credentials cache files
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor