/* dispose of the data dangling from the corpse of a keyring  */
static void keyring_destroy(struct key *keyring)
/* dispose of the data dangling from the corpse of a keyring  */
static void keyring_destroy(struct key *keyring)
{
	struct keyring_list *klist;
	int loop;
	if (keyring->description) {
		write_lock(&keyring_name_lock);
		if (keyring->type_data.link.next != NULL &&
		    !list_empty(&keyring->type_data.link))
			list_del(&keyring->type_data.link);
		write_unlock(&keyring_name_lock);
	}
	klist = rcu_dereference(keyring->payload.subscriptions);
	if (klist) {
		for (loop = klist->nkeys - 1; loop >= 0; loop--)
			key_put(klist->keys[loop]);
		kfree(klist);
	}
}