Linux: Remove unnecessary crhold on incomplete kernel credentials

When credentials debugging is active in the kernel, sanity checks
in various credentials functions such as get_cred or put_cred
require that they are called with full fledged kernel credentials.
This can be a problem with recent kernels in osi_Init where we
build our own credentials and try to "crhold" them.
Getting a reference doesn't make much sense anyway since we're
using a statically allocated structure that we never try to free
or modify.

As a minimal fix, just don't call crhold when we're using
the kernel credentials structure.

Change-Id: If4f843ad33526c6a42f1cf67c57763593ffa50ac
Reviewed-on: http://gerrit.openafs.org/1828
Tested-by: Marc Dionne <marc.c.dionne@gmail.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
This commit is contained in:
Marc Dionne 2010-04-24 22:12:27 -04:00 committed by Derrick Brashear
parent 014821d281
commit 14195f0f48

View File

@ -95,7 +95,9 @@ osi_Init(void)
#if defined(AFS_DARWIN80_ENV)
afs_osi_cred.cr_ref = 1; /* kauth_cred_get_ref needs 1 existing ref */
#else
crhold(&afs_osi_cred); /* don't let it evaporate */
# if !(defined(AFS_LINUX26_ENV) && defined(STRUCT_TASK_HAS_CRED))
crhold(&afs_osi_cred); /* don't let it evaporate */
# endif
#endif
afs_osi_credp = &afs_osi_cred;