/* Search connection list of the SAP and finds connection listening on local mac, and local sap. Returns pointer for parent socket found, NULL otherwise. Caller has to make sure local_bh is disabled.  */
static struct sock* llc_lookup_listener(struct llc_sap *sap, struct llc_addr *laddr)
/* Search connection list of the SAP and finds connection listening on local mac, and local sap. Returns pointer for parent socket found, NULL otherwise. Caller has to make sure local_bh is disabled.  */
static struct sock* llc_lookup_listener(struct llc_sap *sap, struct llc_addr *laddr)
{
	struct sock *rc;
	struct hlist_node *node;
	read_lock(&sap->sk_list.lock);
	sk_for_each(rc, node, &sap->sk_list.list) {
		struct llc_sock *llc = llc_sk(rc);
		if (rc->sk_type == SOCK_STREAM && rc->sk_state == TCP_LISTEN &&
		    llc->laddr.lsap == laddr->lsap &&
		    (llc_mac_match(llc->laddr.mac, laddr->mac) ||
		     llc_mac_null(llc->laddr.mac))) {
			sock_hold(rc);
			goto found;
		}
	}
	rc = NULL;
found:
	read_unlock(&sap->sk_list.lock);
	return rc;
}