aboutsummaryrefslogtreecommitdiffstats
path: root/security/keys/key.c
diff options
context:
space:
mode:
Diffstat (limited to 'security/keys/key.c')
-rw-r--r--security/keys/key.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/security/keys/key.c b/security/keys/key.c
index deb881754e03..bd5a272f28a6 100644
--- a/security/keys/key.c
+++ b/security/keys/key.c
@@ -227,7 +227,6 @@ struct key *key_alloc(struct key_type *type, const char *desc,
227 key_perm_t perm, unsigned long flags, 227 key_perm_t perm, unsigned long flags,
228 int (*restrict_link)(struct key *, 228 int (*restrict_link)(struct key *,
229 const struct key_type *, 229 const struct key_type *,
230 unsigned long,
231 const union key_payload *)) 230 const union key_payload *))
232{ 231{
233 struct key_user *user = NULL; 232 struct key_user *user = NULL;
@@ -300,8 +299,6 @@ struct key *key_alloc(struct key_type *type, const char *desc,
300 299
301 if (!(flags & KEY_ALLOC_NOT_IN_QUOTA)) 300 if (!(flags & KEY_ALLOC_NOT_IN_QUOTA))
302 key->flags |= 1 << KEY_FLAG_IN_QUOTA; 301 key->flags |= 1 << KEY_FLAG_IN_QUOTA;
303 if (flags & KEY_ALLOC_TRUSTED)
304 key->flags |= 1 << KEY_FLAG_TRUSTED;
305 if (flags & KEY_ALLOC_BUILT_IN) 302 if (flags & KEY_ALLOC_BUILT_IN)
306 key->flags |= 1 << KEY_FLAG_BUILTIN; 303 key->flags |= 1 << KEY_FLAG_BUILTIN;
307 304
@@ -504,7 +501,7 @@ int key_instantiate_and_link(struct key *key,
504 if (keyring) { 501 if (keyring) {
505 if (keyring->restrict_link) { 502 if (keyring->restrict_link) {
506 ret = keyring->restrict_link(keyring, key->type, 503 ret = keyring->restrict_link(keyring, key->type,
507 key->flags, &prep.payload); 504 &prep.payload);
508 if (ret < 0) 505 if (ret < 0)
509 goto error; 506 goto error;
510 } 507 }
@@ -811,7 +808,6 @@ key_ref_t key_create_or_update(key_ref_t keyring_ref,
811 int ret; 808 int ret;
812 int (*restrict_link)(struct key *, 809 int (*restrict_link)(struct key *,
813 const struct key_type *, 810 const struct key_type *,
814 unsigned long,
815 const union key_payload *) = NULL; 811 const union key_payload *) = NULL;
816 812
817 /* look up the key type to see if it's one of the registered kernel 813 /* look up the key type to see if it's one of the registered kernel
@@ -843,7 +839,6 @@ key_ref_t key_create_or_update(key_ref_t keyring_ref,
843 prep.data = payload; 839 prep.data = payload;
844 prep.datalen = plen; 840 prep.datalen = plen;
845 prep.quotalen = index_key.type->def_datalen; 841 prep.quotalen = index_key.type->def_datalen;
846 prep.trusted = flags & KEY_ALLOC_TRUSTED;
847 prep.expiry = TIME_T_MAX; 842 prep.expiry = TIME_T_MAX;
848 if (index_key.type->preparse) { 843 if (index_key.type->preparse) {
849 ret = index_key.type->preparse(&prep); 844 ret = index_key.type->preparse(&prep);
@@ -860,9 +855,7 @@ key_ref_t key_create_or_update(key_ref_t keyring_ref,
860 index_key.desc_len = strlen(index_key.description); 855 index_key.desc_len = strlen(index_key.description);
861 856
862 if (restrict_link) { 857 if (restrict_link) {
863 unsigned long kflags = prep.trusted ? KEY_FLAG_TRUSTED : 0; 858 ret = restrict_link(keyring, index_key.type, &prep.payload);
864 ret = restrict_link(keyring,
865 index_key.type, kflags, &prep.payload);
866 if (ret < 0) { 859 if (ret < 0) {
867 key_ref = ERR_PTR(ret); 860 key_ref = ERR_PTR(ret);
868 goto error_free_prep; 861 goto error_free_prep;