unsigned long flags; struct key *key, *ret, *err, *tmp; 
struct key *key, *ret, *err; 
struct key *search_process_keyrings_aux(struct key_type *type,					const void *description,					key_match_func_t match){	struct task_struct *tsk = current;	unsigned long flags;	struct key *key, *ret, *err, *tmp;	/* we want to return -EAGAIN or -ENOKEY if any of the keyrings were	 * searchable, but we failed to find a key or we found a negative key;	 * otherwise we want to return a sample error (probably -EACCES) if	 * none of the keyrings were searchable	 *	 * in terms of priority: success > -ENOKEY > -EAGAIN > other error	 */	key = NULL;	ret = NULL;	err = ERR_PTR(-EAGAIN);	/* search the thread keyring first */	if (tsk->thread_keyring) {		key = keyring_search_aux(tsk->thread_keyring, type,					 description, match);		if (!IS_ERR(key))			goto found;		switch (PTR_ERR(key)) {		case -EAGAIN: /* no key */			if (ret)				break;		case -ENOKEY: /* negative key */			ret = key;			break;		default:			err = key;			break;		}	}	/* search the process keyring second */	if (tsk->signal->process_keyring) {		key = keyring_search_aux(tsk->signal->process_keyring,					 type, description, match);		if (!IS_ERR(key))			goto found;		switch (PTR_ERR(key)) {		case -EAGAIN: /* no key */			if (ret)				break;		case -ENOKEY: /* negative key */			ret = key;			break;		default:			err = key;			break;		}	}	/* search the session keyring last */	spin_lock_irqsave(&tsk->sighand->siglock, flags);	tmp = tsk->signal->session_keyring;	if (!tmp)		tmp = tsk->user->session_keyring;	atomic_inc(&tmp->usage);	spin_unlock_irqrestore(&tsk->sighand->siglock, flags);	key = keyring_search_aux(tmp, type, description, match);	key_put(tmp);	if (!IS_ERR(key))		goto found;	switch (PTR_ERR(key)) {	case -EAGAIN: /* no key */		if (ret)			break;	case -ENOKEY: /* negative key */		ret = key;		break;	default:		err = key;		break;	}	/* no key - decide on the error we're going to go for */	key = ret ? ret : err; found:	return key;} /* end search_process_keyrings_aux() */
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/8589b4e00e352f983259140f25a262d973be6bc5/process_keys.c/buggy/security/keys/process_keys.c