Linux Keyrings: don't ignore error code from session keyring creation

Creating a session keyring can fail, for instance if the user's
keyring quotas are reached (number of keys/keyrings or data size).

Instead of ignoring errors, return them so they can be passed back
to the caller.

FIXES 126230

Change-Id: I745abeef4b3b8e4c3ab1b90667c6a5478c1e0ad2
Change-Id: I4b0ce6423ee493fbbcbdac1c580e3a157d3c11f4
Reviewed-on: http://gerrit.openafs.org/1151
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
This commit is contained in:
Marc Dionne 2010-01-22 20:03:58 -05:00 committed by Derrick Brashear
parent 8462b1a1b2
commit 0caf14224a

View File

@ -228,9 +228,8 @@ setpag(cred_t **cr, afs_uint32 pagvalue, afs_uint32 *newpag,
#ifdef LINUX_KEYRING_SUPPORT
if (code == 0 && afs_cr_rgid(*cr) != NFSXLATOR_CRED) {
(void) install_session_keyring(NULL);
if (current_session_keyring()) {
code = install_session_keyring(NULL);
if (code == 0 && current_session_keyring()) {
struct key *key;
key_perm_t perm;
@ -243,6 +242,8 @@ setpag(cred_t **cr, afs_uint32 pagvalue, afs_uint32 *newpag,
key_instantiate_and_link(key, (void *) newpag, sizeof(afs_uint32),
current_session_keyring(), NULL);
key_put(key);
} else {
code = PTR_ERR(key);
}
}
}