From a27bed59cae1a4244429c752edfde0a8363c8a3b Mon Sep 17 00:00:00 2001 From: Andrew Deason Date: Thu, 25 Sep 2014 12:34:18 -0500 Subject: [PATCH] afs: Move init_hckernel_init to osi_Init Currently we call init_hckernel_init inside afs_InitSetup, to initialize the hcrypto mutex. However, we use the hcrypto mutex in the AFSOP_SEED_ENTROPY syscall, which afsd calls before any syscall that cals afs_InitSetup. This means we crash on trying to AFSOP_SEED_ENTROPY. To avoid this, just call init_hckernel_init inside osi_Init instead, which is called when our kernel module itself is initialized. This ensures that the mutex is initialized early on, regardless of what happens with afsd and the startup syscalls. Change-Id: Ib6cbed7abcfd8f9a61685f613a848e9f36d6050d Reviewed-on: http://gerrit.openafs.org/11509 Tested-by: Andrew Deason Tested-by: BuildBot Reviewed-by: Benjamin Kaduk Reviewed-by: Jeffrey Altman --- src/afs/afs_call.c | 10 ---------- src/afs/afs_osi.c | 11 +++++++++++ 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/afs/afs_call.c b/src/afs/afs_call.c index f3448ed..43d7778 100644 --- a/src/afs/afs_call.c +++ b/src/afs/afs_call.c @@ -35,11 +35,6 @@ #endif #include -/* No hckernel-specific header for this prototype. */ -#ifndef UKERNEL -extern void init_hckernel_mutex(void); -#endif - #if defined(AFS_SUN5_ENV) || defined(AFS_AIX_ENV) || defined(AFS_SGI_ENV) || defined(AFS_HPUX_ENV) #define AFS_MINBUFFERS 100 #else @@ -107,11 +102,6 @@ afs_InitSetup(int preallocs) if (afs_InitSetup_done) return EAGAIN; - /* Initialize a lock for the kernel hcrypto bits. */ -#ifndef UKERNEL - init_hckernel_mutex(); -#endif - #ifdef AFS_SUN510_ENV /* Initialize a RW lock for the ifinfo global array */ rw_init(&afsifinfo_lock, NULL, RW_DRIVER, NULL); diff --git a/src/afs/afs_osi.c b/src/afs/afs_osi.c index 3eb176b..9398376 100644 --- a/src/afs/afs_osi.c +++ b/src/afs/afs_osi.c @@ -24,6 +24,11 @@ * -- On HP called from afsc_link. * -- On SGI called from afs_init. */ +/* No hckernel-specific header for this prototype. */ +#ifndef UKERNEL +extern void init_hckernel_mutex(void); +#endif + afs_lock_t afs_ftf; /* flush text lock */ #ifdef AFS_SGI53_ENV @@ -78,6 +83,12 @@ osi_Init(void) osi_InitGlock(); + /* Initialize a lock for the kernel hcrypto bits. */ +#ifndef UKERNEL + init_hckernel_mutex(); +#endif + + if (!afs_osicred_initialized) { #if defined(AFS_DARWIN80_ENV) afs_osi_ctxtp_initialized = 0; -- 1.9.4