keys: Move the RCU locks outwards from the keyring search functions
Move the RCU locks outwards from the keyring search functions so that it will become possible to provide an RCU-capable partial request_key() function in a later commit. Signed-off-by: David Howells <dhowells@redhat.com>
This commit is contained in:
@@ -385,7 +385,9 @@ static int construct_alloc_key(struct keyring_search_context *ctx,
|
||||
* waited for locks */
|
||||
mutex_lock(&key_construction_mutex);
|
||||
|
||||
key_ref = search_process_keyrings(ctx);
|
||||
rcu_read_lock();
|
||||
key_ref = search_process_keyrings_rcu(ctx);
|
||||
rcu_read_unlock();
|
||||
if (!IS_ERR(key_ref))
|
||||
goto key_already_present;
|
||||
|
||||
@@ -561,7 +563,9 @@ struct key *request_key_and_link(struct key_type *type,
|
||||
}
|
||||
|
||||
/* search all the process keyrings for a key */
|
||||
key_ref = search_process_keyrings(&ctx);
|
||||
rcu_read_lock();
|
||||
key_ref = search_process_keyrings_rcu(&ctx);
|
||||
rcu_read_unlock();
|
||||
|
||||
if (!IS_ERR(key_ref)) {
|
||||
if (dest_keyring) {
|
||||
|
Reference in New Issue
Block a user