[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <155923717710.949.2790063022835028361.stgit@warthog.procyon.org.uk>
Date: Thu, 30 May 2019 18:26:17 +0100
From: David Howells <dhowells@...hat.com>
To: keyrings@...r.kernel.org
Cc: Eric Biggers <ebiggers@...gle.com>,
James Morris <jamorris@...ux.microsoft.com>,
dhowells@...hat.com, linux-security-module@...r.kernel.org,
linux-kernel@...r.kernel.org, ebiggers@...nel.org
Subject: [PATCH 09/10] KEYS: reuse keyring_index_key::desc_len in
lookup_user_key() [ver #2]
From: Eric Biggers <ebiggers@...gle.com>
When lookup_user_key() checks whether the key is possessed, it should
use the key's existing index_key including the 'desc_len' field, rather
than recomputing the 'desc_len'. This doesn't change the behavior; this
way is just simpler and faster.
Signed-off-by: Eric Biggers <ebiggers@...gle.com>
Signed-off-by: David Howells <dhowells@...hat.com>
Reviewed-by: James Morris <jamorris@...ux.microsoft.com>
---
security/keys/process_keys.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/security/keys/process_keys.c b/security/keys/process_keys.c
index ba5d3172cafe..39aaa21462bf 100644
--- a/security/keys/process_keys.c
+++ b/security/keys/process_keys.c
@@ -688,9 +688,7 @@ key_ref_t lookup_user_key(key_serial_t id, unsigned long lflags,
key_ref = make_key_ref(key, 0);
/* check to see if we possess the key */
- ctx.index_key.type = key->type;
- ctx.index_key.description = key->description;
- ctx.index_key.desc_len = strlen(key->description);
+ ctx.index_key = key->index_key;
ctx.match_data.raw_data = key;
kdebug("check possessed");
skey_ref = search_process_keyrings(&ctx);
Powered by blists - more mailing lists