aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--security/keys/internal.h3
-rw-r--r--security/keys/key.c2
-rw-r--r--security/keys/keyring.c9
3 files changed, 5 insertions, 9 deletions
diff --git a/security/keys/internal.h b/security/keys/internal.h
index f4bf938b68b4..73950bf8f875 100644
--- a/security/keys/internal.h
+++ b/security/keys/internal.h
@@ -99,8 +99,7 @@ extern void __key_link_end(struct key *keyring,
99 unsigned long prealloc); 99 unsigned long prealloc);
100 100
101extern key_ref_t __keyring_search_one(key_ref_t keyring_ref, 101extern key_ref_t __keyring_search_one(key_ref_t keyring_ref,
102 const struct keyring_index_key *index_key, 102 const struct keyring_index_key *index_key);
103 key_perm_t perm);
104 103
105extern struct key *keyring_search_instkey(struct key *keyring, 104extern struct key *keyring_search_instkey(struct key *keyring,
106 key_serial_t target_id); 105 key_serial_t target_id);
diff --git a/security/keys/key.c b/security/keys/key.c
index 1e23cc288106..7d716b82a61e 100644
--- a/security/keys/key.c
+++ b/security/keys/key.c
@@ -847,7 +847,7 @@ key_ref_t key_create_or_update(key_ref_t keyring_ref,
847 * update that instead if possible 847 * update that instead if possible
848 */ 848 */
849 if (index_key.type->update) { 849 if (index_key.type->update) {
850 key_ref = __keyring_search_one(keyring_ref, &index_key, 0); 850 key_ref = __keyring_search_one(keyring_ref, &index_key);
851 if (!IS_ERR(key_ref)) 851 if (!IS_ERR(key_ref))
852 goto found_matching_key; 852 goto found_matching_key;
853 } 853 }
diff --git a/security/keys/keyring.c b/security/keys/keyring.c
index 87eff32b53f4..eeef1a073db4 100644
--- a/security/keys/keyring.c
+++ b/security/keys/keyring.c
@@ -531,15 +531,14 @@ EXPORT_SYMBOL(keyring_search);
531 * RCU is used to make it unnecessary to lock the keyring key list here. 531 * RCU is used to make it unnecessary to lock the keyring key list here.
532 * 532 *
533 * Returns a pointer to the found key with usage count incremented if 533 * Returns a pointer to the found key with usage count incremented if
534 * successful and returns -ENOKEY if not found. Revoked keys and keys not 534 * successful and returns -ENOKEY if not found. Revoked and invalidated keys
535 * providing the requested permission are skipped over. 535 * are skipped over.
536 * 536 *
537 * If successful, the possession indicator is propagated from the keyring ref 537 * If successful, the possession indicator is propagated from the keyring ref
538 * to the returned key reference. 538 * to the returned key reference.
539 */ 539 */
540key_ref_t __keyring_search_one(key_ref_t keyring_ref, 540key_ref_t __keyring_search_one(key_ref_t keyring_ref,
541 const struct keyring_index_key *index_key, 541 const struct keyring_index_key *index_key)
542 key_perm_t perm)
543{ 542{
544 struct keyring_list *klist; 543 struct keyring_list *klist;
545 struct key *keyring, *key; 544 struct key *keyring, *key;
@@ -560,8 +559,6 @@ key_ref_t __keyring_search_one(key_ref_t keyring_ref,
560 if (key->type == index_key->type && 559 if (key->type == index_key->type &&
561 (!key->type->match || 560 (!key->type->match ||
562 key->type->match(key, index_key->description)) && 561 key->type->match(key, index_key->description)) &&
563 key_permission(make_key_ref(key, possessed),
564 perm) == 0 &&
565 !(key->flags & ((1 << KEY_FLAG_INVALIDATED) | 562 !(key->flags & ((1 << KEY_FLAG_INVALIDATED) |
566 (1 << KEY_FLAG_REVOKED))) 563 (1 << KEY_FLAG_REVOKED)))
567 ) 564 )