|
@@ -339,8 +339,10 @@ static int construct_alloc_key(struct key_type *type,
|
|
|
|
|
|
key_already_present:
|
|
key_already_present:
|
|
mutex_unlock(&key_construction_mutex);
|
|
mutex_unlock(&key_construction_mutex);
|
|
- if (dest_keyring)
|
|
|
|
|
|
+ if (dest_keyring) {
|
|
|
|
+ __key_link(dest_keyring, key_ref_to_ptr(key_ref));
|
|
up_write(&dest_keyring->sem);
|
|
up_write(&dest_keyring->sem);
|
|
|
|
+ }
|
|
mutex_unlock(&user->cons_lock);
|
|
mutex_unlock(&user->cons_lock);
|
|
key_put(key);
|
|
key_put(key);
|
|
*_key = key = key_ref_to_ptr(key_ref);
|
|
*_key = key = key_ref_to_ptr(key_ref);
|
|
@@ -431,6 +433,11 @@ struct key *request_key_and_link(struct key_type *type,
|
|
|
|
|
|
if (!IS_ERR(key_ref)) {
|
|
if (!IS_ERR(key_ref)) {
|
|
key = key_ref_to_ptr(key_ref);
|
|
key = key_ref_to_ptr(key_ref);
|
|
|
|
+ if (dest_keyring) {
|
|
|
|
+ construct_get_dest_keyring(&dest_keyring);
|
|
|
|
+ key_link(dest_keyring, key);
|
|
|
|
+ key_put(dest_keyring);
|
|
|
|
+ }
|
|
} else if (PTR_ERR(key_ref) != -EAGAIN) {
|
|
} else if (PTR_ERR(key_ref) != -EAGAIN) {
|
|
key = ERR_CAST(key_ref);
|
|
key = ERR_CAST(key_ref);
|
|
} else {
|
|
} else {
|