X-Git-Url: https://git.openpandora.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=security%2Fkeys%2Fkey.c;h=1f5c2c53fa9d1011435aca60eadbdbd8f77fdc00;hb=34ee743350e4b69467822c1c58df6d933893d040;hp=4414abddcb5bfd6951d168018990c6df2567b901;hpb=83f89ca755c9f783b8229d968c4e9d2c660ca427;p=pandora-kernel.git diff --git a/security/keys/key.c b/security/keys/key.c index 4414abddcb5b..1f5c2c53fa9d 100644 --- a/security/keys/key.c +++ b/security/keys/key.c @@ -305,6 +305,8 @@ struct key *key_alloc(struct key_type *type, const char *desc, if (!(flags & KEY_ALLOC_NOT_IN_QUOTA)) key->flags |= 1 << KEY_FLAG_IN_QUOTA; + if (flags & KEY_ALLOC_UID_KEYRING) + key->flags |= 1 << KEY_FLAG_UID_KEYRING; memset(&key->type_data, 0, sizeof(key->type_data)); @@ -572,7 +574,7 @@ int key_reject_and_link(struct key *key, mutex_unlock(&key_construction_mutex); - if (keyring) + if (keyring && link_ret == 0) __key_link_end(keyring, key->type, prealloc); /* wake up anyone waiting for a key to be constructed */ @@ -847,6 +849,16 @@ key_ref_t key_create_or_update(key_ref_t keyring_ref, __key_link_end(keyring, ktype, prealloc); key_type_put(ktype); + key = key_ref_to_ptr(key_ref); + if (test_bit(KEY_FLAG_USER_CONSTRUCT, &key->flags)) { + ret = wait_for_key_construction(key, true); + if (ret < 0) { + key_ref_put(key_ref); + key_ref = ERR_PTR(ret); + goto error; + } + } + key_ref = __key_update(key_ref, payload, plen); goto error; }