From: Mark Vitale Date: Fri, 4 Oct 2013 01:42:10 +0000 (-0400) Subject: auth: prevent uninitialized key list in AFS config X-Git-Tag: openafs-stable-1_8_0pre1~959 X-Git-Url: https://git.openafs.org/?p=openafs.git;a=commitdiff_plain;h=7b5f27f944ad773a45f1d47fa9b8962097999783 auth: prevent uninitialized key list in AFS config _afsconf_OpenInternal() may exit early for a number of reasons before properly initalizing afsconf_dir->listKeys. This leads to a crash when _afsconf_CloseInternal() attempts to clean up listKeys. Prevent this situation by calling afsconf_InitKeys() before any possible exit from _afsconf_OpenInternal(). Change-Id: I6911427817a2518a576c00a7ea56351f9fb4fd19 Reviewed-on: http://gerrit.openafs.org/10323 Tested-by: BuildBot Reviewed-by: Benjamin Kaduk Reviewed-by: Derrick Brashear --- diff --git a/src/auth/cellconfig.c b/src/auth/cellconfig.c index 14c03b4..2509ec7 100644 --- a/src/auth/cellconfig.c +++ b/src/auth/cellconfig.c @@ -632,6 +632,9 @@ afsconf_OpenInternal(struct afsconf_dir *adir, char *cell, cm_enumCellRegistry_t enumCellRegistry = {0, 0}; #endif /* AFS_NT40_ENV */ + /* init the keys queue before any call to afsconf_CloseInternal() */ + _afsconf_InitKeys(adir); + /* figure out the local cell name */ #ifdef AFS_NT40_ENV i = GetCellNT(adir); @@ -667,9 +670,6 @@ afsconf_OpenInternal(struct afsconf_dir *adir, char *cell, return -1; } - /* init the keys queue before any call to afsconf_CloseInternal() */ - _afsconf_InitKeys(adir); - /* The CellServDB file is now open. * The following code parses the contents of the * file and creates a list with the first cell entry