keys: Simplify key description management
[linux-2.6-microblaze.git] / security / keys / key.c
index e792d65..0a3828f 100644 (file)
@@ -285,6 +285,7 @@ struct key *key_alloc(struct key_type *type, const char *desc,
        key->index_key.description = kmemdup(desc, desclen + 1, GFP_KERNEL);
        if (!key->index_key.description)
                goto no_memory_3;
+       key_set_index_key(&key->index_key);
 
        refcount_set(&key->usage, 1);
        init_rwsem(&key->sem);
@@ -868,6 +869,7 @@ key_ref_t key_create_or_update(key_ref_t keyring_ref,
                        goto error_free_prep;
        }
        index_key.desc_len = strlen(index_key.description);
+       key_set_index_key(&index_key);
 
        ret = __key_link_lock(keyring, &index_key);
        if (ret < 0) {