diff options
Diffstat (limited to 'security/keys/request_key.c')
-rw-r--r-- | security/keys/request_key.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/security/keys/request_key.c b/security/keys/request_key.c index ea97c3120d66..d737cea5347c 100644 --- a/security/keys/request_key.c +++ b/security/keys/request_key.c | |||
@@ -339,8 +339,10 @@ static int construct_alloc_key(struct key_type *type, | |||
339 | 339 | ||
340 | key_already_present: | 340 | key_already_present: |
341 | mutex_unlock(&key_construction_mutex); | 341 | mutex_unlock(&key_construction_mutex); |
342 | if (dest_keyring) | 342 | if (dest_keyring) { |
343 | __key_link(dest_keyring, key_ref_to_ptr(key_ref)); | ||
343 | up_write(&dest_keyring->sem); | 344 | up_write(&dest_keyring->sem); |
345 | } | ||
344 | mutex_unlock(&user->cons_lock); | 346 | mutex_unlock(&user->cons_lock); |
345 | key_put(key); | 347 | key_put(key); |
346 | *_key = key = key_ref_to_ptr(key_ref); | 348 | *_key = key = key_ref_to_ptr(key_ref); |
@@ -431,6 +433,11 @@ struct key *request_key_and_link(struct key_type *type, | |||
431 | 433 | ||
432 | if (!IS_ERR(key_ref)) { | 434 | if (!IS_ERR(key_ref)) { |
433 | key = key_ref_to_ptr(key_ref); | 435 | key = key_ref_to_ptr(key_ref); |
436 | if (dest_keyring) { | ||
437 | construct_get_dest_keyring(&dest_keyring); | ||
438 | key_link(dest_keyring, key); | ||
439 | key_put(dest_keyring); | ||
440 | } | ||
434 | } else if (PTR_ERR(key_ref) != -EAGAIN) { | 441 | } else if (PTR_ERR(key_ref) != -EAGAIN) { |
435 | key = ERR_CAST(key_ref); | 442 | key = ERR_CAST(key_ref); |
436 | } else { | 443 | } else { |