if ((user = ax25_findbyuid(current->euid)) == NULL) { 
user = ax25_findbyuid(current->euid); if (user) { nr->user_addr   = user->call; ax25_uid_put(user); } else { 
static int nr_connect(struct socket *sock, struct sockaddr *uaddr,	int addr_len, int flags){	struct sock *sk = sock->sk;	struct nr_sock *nr = nr_sk(sk);	struct sockaddr_ax25 *addr = (struct sockaddr_ax25 *)uaddr;	ax25_address *user, *source = NULL;	struct net_device *dev;	lock_sock(sk);	if (sk->sk_state == TCP_ESTABLISHED && sock->state == SS_CONNECTING) {		sock->state = SS_CONNECTED;		release_sock(sk);		return 0;	/* Connect completed during a ERESTARTSYS event */	}	if (sk->sk_state == TCP_CLOSE && sock->state == SS_CONNECTING) {		sock->state = SS_UNCONNECTED;		release_sock(sk);		return -ECONNREFUSED;	}	if (sk->sk_state == TCP_ESTABLISHED) {		release_sock(sk);		return -EISCONN;	/* No reconnect on a seqpacket socket */	}	sk->sk_state   = TCP_CLOSE;		sock->state = SS_UNCONNECTED;	if (addr_len != sizeof(struct sockaddr_ax25) && addr_len != sizeof(struct full_sockaddr_ax25)) {		release_sock(sk);		return -EINVAL;	}	if (addr->sax25_family != AF_NETROM) {		release_sock(sk);		return -EINVAL;	}	if (sock_flag(sk, SOCK_ZAPPED)) {	/* Must bind first - autobinding in this may or may not work */		sock_reset_flag(sk, SOCK_ZAPPED);		if ((dev = nr_dev_first()) == NULL) {			release_sock(sk);			return -ENETUNREACH;		}		source = (ax25_address *)dev->dev_addr;		if ((user = ax25_findbyuid(current->euid)) == NULL) {			if (ax25_uid_policy && !capable(CAP_NET_ADMIN)) {				dev_put(dev);				release_sock(sk);				return -EPERM;			}			user = source;		}		nr->user_addr   = *user;		nr->source_addr = *source;		nr->device      = dev;		dev_put(dev);		nr_insert_socket(sk);		/* Finish the bind */	}	nr->dest_addr = addr->sax25_call;	release_sock(sk);	circuit = nr_find_next_circuit();	lock_sock(sk);	nr->my_index = circuit / 256;	nr->my_id    = circuit % 256;	circuit++;	/* Move to connecting socket, start sending Connect Requests */	sock->state  = SS_CONNECTING;	sk->sk_state = TCP_SYN_SENT;	nr_establish_data_link(sk);	nr->state = NR_STATE_1;	nr_start_heartbeat(sk);	/* Now the loop */	if (sk->sk_state != TCP_ESTABLISHED && (flags & O_NONBLOCK)) {		release_sock(sk);		return -EINPROGRESS;	}			/*	 * A Connect Ack with Choke or timeout or failed routing will go to	 * closed.	 */	if (sk->sk_state == TCP_SYN_SENT) {		struct task_struct *tsk = current;		DECLARE_WAITQUEUE(wait, tsk);		add_wait_queue(sk->sk_sleep, &wait);		for (;;) {			set_current_state(TASK_INTERRUPTIBLE);			if (sk->sk_state != TCP_SYN_SENT)				break;			release_sock(sk);			if (!signal_pending(tsk)) {				schedule();				lock_sock(sk);				continue;			}			current->state = TASK_RUNNING;			remove_wait_queue(sk->sk_sleep, &wait);			return -ERESTARTSYS;		}		current->state = TASK_RUNNING;		remove_wait_queue(sk->sk_sleep, &wait);	}	if (sk->sk_state != TCP_ESTABLISHED) {		sock->state = SS_UNCONNECTED;		release_sock(sk);		return sock_error(sk);	/* Always set at this point */	}	sock->state = SS_CONNECTED;	release_sock(sk);	return 0;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/01d7dd0e9f8c5f1888619d2649c7da389232b408/af_netrom.c/buggy/net/netrom/af_netrom.c