Lines Matching full:other

52  *		other the moment one end closes.
464 static int unix_dgram_peer_wake_connect(struct sock *sk, struct sock *other) in unix_dgram_peer_wake_connect() argument
470 u_other = unix_sk(other); in unix_dgram_peer_wake_connect()
475 u->peer_wake.private = other; in unix_dgram_peer_wake_connect()
486 struct sock *other) in unix_dgram_peer_wake_disconnect() argument
491 u_other = unix_sk(other); in unix_dgram_peer_wake_disconnect()
494 if (u->peer_wake.private == other) { in unix_dgram_peer_wake_disconnect()
503 struct sock *other) in unix_dgram_peer_wake_disconnect_wakeup() argument
505 unix_dgram_peer_wake_disconnect(sk, other); in unix_dgram_peer_wake_disconnect_wakeup()
513 * - unix_peer(sk) == other
516 static int unix_dgram_peer_wake_me(struct sock *sk, struct sock *other) in unix_dgram_peer_wake_me() argument
520 connected = unix_dgram_peer_wake_connect(sk, other); in unix_dgram_peer_wake_me()
522 /* If other is SOCK_DEAD, we want to make sure we signal in unix_dgram_peer_wake_me()
525 * to other and its full, we will hang waiting for POLLOUT. in unix_dgram_peer_wake_me()
527 if (unix_recvq_full_lockless(other) && !sock_flag(other, SOCK_DEAD)) in unix_dgram_peer_wake_me()
531 unix_dgram_peer_wake_disconnect(sk, other); in unix_dgram_peer_wake_me()
561 static void unix_dgram_disconnected(struct sock *sk, struct sock *other) in unix_dgram_disconnected() argument
571 if (!sock_flag(other, SOCK_DEAD) && unix_peer(other) == sk) { in unix_dgram_disconnected()
572 WRITE_ONCE(other->sk_err, ECONNRESET); in unix_dgram_disconnected()
573 sk_error_report(other); in unix_dgram_disconnected()
576 other->sk_state = TCP_CLOSE; in unix_dgram_disconnected()
1372 struct sock *other; in unix_dgram_connect() local
1393 other = unix_find_other(sock_net(sk), sunaddr, alen, sock->type); in unix_dgram_connect()
1394 if (IS_ERR(other)) { in unix_dgram_connect()
1395 err = PTR_ERR(other); in unix_dgram_connect()
1399 unix_state_double_lock(sk, other); in unix_dgram_connect()
1402 if (sock_flag(other, SOCK_DEAD)) { in unix_dgram_connect()
1403 unix_state_double_unlock(sk, other); in unix_dgram_connect()
1404 sock_put(other); in unix_dgram_connect()
1409 if (!unix_may_send(sk, other)) in unix_dgram_connect()
1412 err = security_unix_may_send(sk->sk_socket, other->sk_socket); in unix_dgram_connect()
1416 sk->sk_state = other->sk_state = TCP_ESTABLISHED; in unix_dgram_connect()
1421 other = NULL; in unix_dgram_connect()
1422 unix_state_double_lock(sk, other); in unix_dgram_connect()
1431 unix_peer(sk) = other; in unix_dgram_connect()
1432 if (!other) in unix_dgram_connect()
1436 unix_state_double_unlock(sk, other); in unix_dgram_connect()
1438 if (other != old_peer) in unix_dgram_connect()
1442 unix_peer(sk) = other; in unix_dgram_connect()
1443 unix_state_double_unlock(sk, other); in unix_dgram_connect()
1449 unix_state_double_unlock(sk, other); in unix_dgram_connect()
1450 sock_put(other); in unix_dgram_connect()
1455 static long unix_wait_for_peer(struct sock *other, long timeo) in unix_wait_for_peer() argument
1456 __releases(&unix_sk(other)->lock) in unix_wait_for_peer()
1458 struct unix_sock *u = unix_sk(other); in unix_wait_for_peer()
1464 sched = !sock_flag(other, SOCK_DEAD) && in unix_wait_for_peer()
1465 !(other->sk_shutdown & RCV_SHUTDOWN) && in unix_wait_for_peer()
1466 unix_recvq_full_lockless(other); in unix_wait_for_peer()
1468 unix_state_unlock(other); in unix_wait_for_peer()
1481 struct sock *sk = sock->sk, *newsk = NULL, *other = NULL; in unix_stream_connect() local
1524 other = unix_find_other(net, sunaddr, addr_len, sk->sk_type); in unix_stream_connect()
1525 if (IS_ERR(other)) { in unix_stream_connect()
1526 err = PTR_ERR(other); in unix_stream_connect()
1527 other = NULL; in unix_stream_connect()
1532 unix_state_lock(other); in unix_stream_connect()
1535 if (sock_flag(other, SOCK_DEAD)) { in unix_stream_connect()
1536 unix_state_unlock(other); in unix_stream_connect()
1537 sock_put(other); in unix_stream_connect()
1542 if (other->sk_state != TCP_LISTEN) in unix_stream_connect()
1544 if (other->sk_shutdown & RCV_SHUTDOWN) in unix_stream_connect()
1547 if (unix_recvq_full(other)) { in unix_stream_connect()
1552 timeo = unix_wait_for_peer(other, timeo); in unix_stream_connect()
1557 sock_put(other); in unix_stream_connect()
1567 state. other is TCP_LISTEN, if sk is TCP_LISTEN we in unix_stream_connect()
1591 unix_state_unlock(other); in unix_stream_connect()
1592 sock_put(other); in unix_stream_connect()
1596 err = security_unix_stream_connect(sk, other, newsk); in unix_stream_connect()
1611 otheru = unix_sk(other); in unix_stream_connect()
1638 copy_peercred(sk, other); in unix_stream_connect()
1650 spin_lock(&other->sk_receive_queue.lock); in unix_stream_connect()
1651 __skb_queue_tail(&other->sk_receive_queue, skb); in unix_stream_connect()
1652 spin_unlock(&other->sk_receive_queue.lock); in unix_stream_connect()
1653 unix_state_unlock(other); in unix_stream_connect()
1654 other->sk_data_ready(other); in unix_stream_connect()
1655 sock_put(other); in unix_stream_connect()
1659 if (other) in unix_stream_connect()
1660 unix_state_unlock(other); in unix_stream_connect()
1666 if (other) in unix_stream_connect()
1667 sock_put(other); in unix_stream_connect()
1843 const struct sock *other) in unix_passcred_enabled() argument
1847 !other->sk_socket || in unix_passcred_enabled()
1848 test_bit(SOCK_PASSCRED, &other->sk_socket->flags) || in unix_passcred_enabled()
1849 test_bit(SOCK_PASSPIDFD, &other->sk_socket->flags); in unix_passcred_enabled()
1858 const struct sock *other) in maybe_add_creds() argument
1862 if (unix_passcred_enabled(sock, other)) { in maybe_add_creds()
1903 struct sock *sk = sock->sk, *other = NULL; in unix_dgram_sendmsg() local
1928 other = unix_peer_get(sk); in unix_dgram_sendmsg()
1929 if (!other) in unix_dgram_sendmsg()
1973 if (!other) { in unix_dgram_sendmsg()
1978 other = unix_find_other(sock_net(sk), sunaddr, msg->msg_namelen, in unix_dgram_sendmsg()
1980 if (IS_ERR(other)) { in unix_dgram_sendmsg()
1981 err = PTR_ERR(other); in unix_dgram_sendmsg()
1982 other = NULL; in unix_dgram_sendmsg()
1987 if (sk_filter(other, skb) < 0) { in unix_dgram_sendmsg()
1994 unix_state_lock(other); in unix_dgram_sendmsg()
1997 if (!unix_may_send(sk, other)) in unix_dgram_sendmsg()
2000 if (unlikely(sock_flag(other, SOCK_DEAD))) { in unix_dgram_sendmsg()
2005 unix_state_unlock(other); in unix_dgram_sendmsg()
2006 sock_put(other); in unix_dgram_sendmsg()
2014 * is clearing @other. Never change state to TCP_CLOSE in unix_dgram_sendmsg()
2019 } else if (unix_peer(sk) == other) { in unix_dgram_sendmsg()
2021 unix_dgram_peer_wake_disconnect_wakeup(sk, other); in unix_dgram_sendmsg()
2026 unix_dgram_disconnected(sk, other); in unix_dgram_sendmsg()
2027 sock_put(other); in unix_dgram_sendmsg()
2033 other = NULL; in unix_dgram_sendmsg()
2040 if (other->sk_shutdown & RCV_SHUTDOWN) in unix_dgram_sendmsg()
2044 err = security_unix_may_send(sk->sk_socket, other->sk_socket); in unix_dgram_sendmsg()
2049 /* other == sk && unix_peer(other) != sk if in unix_dgram_sendmsg()
2053 if (other != sk && in unix_dgram_sendmsg()
2054 unlikely(unix_peer(other) != sk && in unix_dgram_sendmsg()
2055 unix_recvq_full_lockless(other))) { in unix_dgram_sendmsg()
2057 timeo = unix_wait_for_peer(other, timeo); in unix_dgram_sendmsg()
2067 unix_state_unlock(other); in unix_dgram_sendmsg()
2068 unix_state_double_lock(sk, other); in unix_dgram_sendmsg()
2071 if (unix_peer(sk) != other || in unix_dgram_sendmsg()
2072 unix_dgram_peer_wake_me(sk, other)) { in unix_dgram_sendmsg()
2087 if (sock_flag(other, SOCK_RCVTSTAMP)) in unix_dgram_sendmsg()
2089 maybe_add_creds(skb, sock, other); in unix_dgram_sendmsg()
2090 scm_stat_add(other, skb); in unix_dgram_sendmsg()
2091 skb_queue_tail(&other->sk_receive_queue, skb); in unix_dgram_sendmsg()
2092 unix_state_unlock(other); in unix_dgram_sendmsg()
2093 other->sk_data_ready(other); in unix_dgram_sendmsg()
2094 sock_put(other); in unix_dgram_sendmsg()
2101 unix_state_unlock(other); in unix_dgram_sendmsg()
2105 if (other) in unix_dgram_sendmsg()
2106 sock_put(other); in unix_dgram_sendmsg()
2117 static int queue_oob(struct socket *sock, struct msghdr *msg, struct sock *other, in queue_oob() argument
2120 struct unix_sock *ousk = unix_sk(other); in queue_oob()
2142 unix_state_lock(other); in queue_oob()
2144 if (sock_flag(other, SOCK_DEAD) || in queue_oob()
2145 (other->sk_shutdown & RCV_SHUTDOWN)) { in queue_oob()
2146 unix_state_unlock(other); in queue_oob()
2151 maybe_add_creds(skb, sock, other); in queue_oob()
2159 scm_stat_add(other, skb); in queue_oob()
2160 skb_queue_tail(&other->sk_receive_queue, skb); in queue_oob()
2161 sk_send_sigurg(other); in queue_oob()
2162 unix_state_unlock(other); in queue_oob()
2163 other->sk_data_ready(other); in queue_oob()
2173 struct sock *other = NULL; in unix_stream_sendmsg() local
2201 other = unix_peer(sk); in unix_stream_sendmsg()
2202 if (!other) in unix_stream_sendmsg()
2262 unix_state_lock(other); in unix_stream_sendmsg()
2264 if (sock_flag(other, SOCK_DEAD) || in unix_stream_sendmsg()
2265 (other->sk_shutdown & RCV_SHUTDOWN)) in unix_stream_sendmsg()
2268 maybe_add_creds(skb, sock, other); in unix_stream_sendmsg()
2269 scm_stat_add(other, skb); in unix_stream_sendmsg()
2270 skb_queue_tail(&other->sk_receive_queue, skb); in unix_stream_sendmsg()
2271 unix_state_unlock(other); in unix_stream_sendmsg()
2272 other->sk_data_ready(other); in unix_stream_sendmsg()
2278 err = queue_oob(sock, msg, other, &scm, fds_sent); in unix_stream_sendmsg()
2290 unix_state_unlock(other); in unix_stream_sendmsg()
2907 struct sock *other; in unix_shutdown() local
2920 other = unix_peer(sk); in unix_shutdown()
2921 if (other) in unix_shutdown()
2922 sock_hold(other); in unix_shutdown()
2926 if (other && in unix_shutdown()
2930 const struct proto *prot = READ_ONCE(other->sk_prot); in unix_shutdown()
2933 prot->unhash(other); in unix_shutdown()
2938 unix_state_lock(other); in unix_shutdown()
2939 WRITE_ONCE(other->sk_shutdown, other->sk_shutdown | peer_mode); in unix_shutdown()
2940 unix_state_unlock(other); in unix_shutdown()
2941 other->sk_state_change(other); in unix_shutdown()
2943 sk_wake_async(other, SOCK_WAKE_WAITD, POLL_HUP); in unix_shutdown()
2945 sk_wake_async(other, SOCK_WAKE_WAITD, POLL_IN); in unix_shutdown()
2947 if (other) in unix_shutdown()
2948 sock_put(other); in unix_shutdown()
3101 * we set writable also when the other side has shut down the in unix_poll()
3113 struct sock *sk = sock->sk, *other; in unix_dgram_poll() local
3156 other = unix_peer(sk); in unix_dgram_poll()
3157 if (other && unix_peer(other) != sk && in unix_dgram_poll()
3158 unix_recvq_full_lockless(other) && in unix_dgram_poll()
3159 unix_dgram_peer_wake_me(sk, other)) in unix_dgram_poll()
3692 /* Earlier than device_initcall() so that other drivers invoking