Skip to content

Commit e57e866

Browse files
committed
KEYS: Drop the permissions argument from __keyring_search_one()
Drop the permissions argument from __keyring_search_one() as the only caller passes 0 here - which causes all checks to be skipped. Signed-off-by: David Howells <[email protected]>
1 parent ccc3e6d commit e57e866

File tree

3 files changed

+5
-9
lines changed

3 files changed

+5
-9
lines changed

security/keys/internal.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,7 @@ extern void __key_link_end(struct key *keyring,
9999
unsigned long prealloc);
100100

101101
extern key_ref_t __keyring_search_one(key_ref_t keyring_ref,
102-
const struct keyring_index_key *index_key,
103-
key_perm_t perm);
102+
const struct keyring_index_key *index_key);
104103

105104
extern struct key *keyring_search_instkey(struct key *keyring,
106105
key_serial_t target_id);

security/keys/key.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -847,7 +847,7 @@ key_ref_t key_create_or_update(key_ref_t keyring_ref,
847847
* update that instead if possible
848848
*/
849849
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);
851851
if (!IS_ERR(key_ref))
852852
goto found_matching_key;
853853
}

security/keys/keyring.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -531,15 +531,14 @@ EXPORT_SYMBOL(keyring_search);
531531
* RCU is used to make it unnecessary to lock the keyring key list here.
532532
*
533533
* 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
535-
* providing the requested permission are skipped over.
534+
* successful and returns -ENOKEY if not found. Revoked and invalidated keys
535+
* are skipped over.
536536
*
537537
* If successful, the possession indicator is propagated from the keyring ref
538538
* to the returned key reference.
539539
*/
540540
key_ref_t __keyring_search_one(key_ref_t keyring_ref,
541-
const struct keyring_index_key *index_key,
542-
key_perm_t perm)
541+
const struct keyring_index_key *index_key)
543542
{
544543
struct keyring_list *klist;
545544
struct key *keyring, *key;
@@ -560,8 +559,6 @@ key_ref_t __keyring_search_one(key_ref_t keyring_ref,
560559
if (key->type == index_key->type &&
561560
(!key->type->match ||
562561
key->type->match(key, index_key->description)) &&
563-
key_permission(make_key_ref(key, possessed),
564-
perm) == 0 &&
565562
!(key->flags & ((1 << KEY_FLAG_INVALIDATED) |
566563
(1 << KEY_FLAG_REVOKED)))
567564
)

0 commit comments

Comments
 (0)