/* wait for construction of a key to complete  */
int wait_for_key_construction(struct key *key, bool intr)
/* wait for construction of a key to complete  */
int wait_for_key_construction(struct key *key, bool intr)
{
	int ret;
	ret = wait_on_bit(&key->flags, KEY_FLAG_USER_CONSTRUCT,
			  intr ? key_wait_bit_intr : key_wait_bit,
			  intr ? TASK_INTERRUPTIBLE : TASK_UNINTERRUPTIBLE);
	if (ret < 0)
		return ret;
	return key_validate(key);
}