Lines Matching full:other
52 * other the moment one end closes.
456 static int unix_dgram_peer_wake_connect(struct sock *sk, struct sock *other) in unix_dgram_peer_wake_connect() argument
462 u_other = unix_sk(other); in unix_dgram_peer_wake_connect()
467 u->peer_wake.private = other; in unix_dgram_peer_wake_connect()
478 struct sock *other) in unix_dgram_peer_wake_disconnect() argument
483 u_other = unix_sk(other); in unix_dgram_peer_wake_disconnect()
486 if (u->peer_wake.private == other) { in unix_dgram_peer_wake_disconnect()
495 struct sock *other) in unix_dgram_peer_wake_disconnect_wakeup() argument
497 unix_dgram_peer_wake_disconnect(sk, other); in unix_dgram_peer_wake_disconnect_wakeup()
505 * - unix_peer(sk) == other
508 static int unix_dgram_peer_wake_me(struct sock *sk, struct sock *other) in unix_dgram_peer_wake_me() argument
512 connected = unix_dgram_peer_wake_connect(sk, other); in unix_dgram_peer_wake_me()
514 /* If other is SOCK_DEAD, we want to make sure we signal in unix_dgram_peer_wake_me()
517 * to other and its full, we will hang waiting for POLLOUT. in unix_dgram_peer_wake_me()
519 if (unix_recvq_full_lockless(other) && !sock_flag(other, SOCK_DEAD)) in unix_dgram_peer_wake_me()
523 unix_dgram_peer_wake_disconnect(sk, other); in unix_dgram_peer_wake_me()
553 static void unix_dgram_disconnected(struct sock *sk, struct sock *other) in unix_dgram_disconnected() argument
563 if (!sock_flag(other, SOCK_DEAD) && unix_peer(other) == sk) { in unix_dgram_disconnected()
564 WRITE_ONCE(other->sk_err, ECONNRESET); in unix_dgram_disconnected()
565 sk_error_report(other); in unix_dgram_disconnected()
1358 struct sock *other; in unix_dgram_connect() local
1379 other = unix_find_other(sock_net(sk), sunaddr, alen, sock->type); in unix_dgram_connect()
1380 if (IS_ERR(other)) { in unix_dgram_connect()
1381 err = PTR_ERR(other); in unix_dgram_connect()
1385 unix_state_double_lock(sk, other); in unix_dgram_connect()
1388 if (sock_flag(other, SOCK_DEAD)) { in unix_dgram_connect()
1389 unix_state_double_unlock(sk, other); in unix_dgram_connect()
1390 sock_put(other); in unix_dgram_connect()
1395 if (!unix_may_send(sk, other)) in unix_dgram_connect()
1398 err = security_unix_may_send(sk->sk_socket, other->sk_socket); in unix_dgram_connect()
1403 WRITE_ONCE(other->sk_state, TCP_ESTABLISHED); in unix_dgram_connect()
1408 other = NULL; in unix_dgram_connect()
1409 unix_state_double_lock(sk, other); in unix_dgram_connect()
1418 unix_peer(sk) = other; in unix_dgram_connect()
1419 if (!other) in unix_dgram_connect()
1423 unix_state_double_unlock(sk, other); in unix_dgram_connect()
1425 if (other != old_peer) { in unix_dgram_connect()
1436 unix_peer(sk) = other; in unix_dgram_connect()
1437 unix_state_double_unlock(sk, other); in unix_dgram_connect()
1443 unix_state_double_unlock(sk, other); in unix_dgram_connect()
1444 sock_put(other); in unix_dgram_connect()
1449 static long unix_wait_for_peer(struct sock *other, long timeo) in unix_wait_for_peer() argument
1450 __releases(&unix_sk(other)->lock) in unix_wait_for_peer()
1452 struct unix_sock *u = unix_sk(other); in unix_wait_for_peer()
1458 sched = !sock_flag(other, SOCK_DEAD) && in unix_wait_for_peer()
1459 !(other->sk_shutdown & RCV_SHUTDOWN) && in unix_wait_for_peer()
1460 unix_recvq_full_lockless(other); in unix_wait_for_peer()
1462 unix_state_unlock(other); in unix_wait_for_peer()
1475 struct sock *sk = sock->sk, *newsk = NULL, *other = NULL; in unix_stream_connect() local
1519 other = unix_find_other(net, sunaddr, addr_len, sk->sk_type); in unix_stream_connect()
1520 if (IS_ERR(other)) { in unix_stream_connect()
1521 err = PTR_ERR(other); in unix_stream_connect()
1522 other = NULL; in unix_stream_connect()
1526 unix_state_lock(other); in unix_stream_connect()
1529 if (sock_flag(other, SOCK_DEAD)) { in unix_stream_connect()
1530 unix_state_unlock(other); in unix_stream_connect()
1531 sock_put(other); in unix_stream_connect()
1536 if (other->sk_state != TCP_LISTEN) in unix_stream_connect()
1538 if (other->sk_shutdown & RCV_SHUTDOWN) in unix_stream_connect()
1541 if (unix_recvq_full_lockless(other)) { in unix_stream_connect()
1546 timeo = unix_wait_for_peer(other, timeo); in unix_stream_connect()
1551 sock_put(other); in unix_stream_connect()
1572 err = security_unix_stream_connect(sk, other, newsk); in unix_stream_connect()
1587 otheru = unix_sk(other); in unix_stream_connect()
1614 copy_peercred(sk, other); in unix_stream_connect()
1626 spin_lock(&other->sk_receive_queue.lock); in unix_stream_connect()
1627 __skb_queue_tail(&other->sk_receive_queue, skb); in unix_stream_connect()
1628 spin_unlock(&other->sk_receive_queue.lock); in unix_stream_connect()
1629 unix_state_unlock(other); in unix_stream_connect()
1630 other->sk_data_ready(other); in unix_stream_connect()
1631 sock_put(other); in unix_stream_connect()
1635 if (other) in unix_stream_connect()
1636 unix_state_unlock(other); in unix_stream_connect()
1642 if (other) in unix_stream_connect()
1643 sock_put(other); in unix_stream_connect()
1819 const struct sock *other) in unix_passcred_enabled() argument
1823 !other->sk_socket || in unix_passcred_enabled()
1824 test_bit(SOCK_PASSCRED, &other->sk_socket->flags) || in unix_passcred_enabled()
1825 test_bit(SOCK_PASSPIDFD, &other->sk_socket->flags); in unix_passcred_enabled()
1834 const struct sock *other) in maybe_add_creds() argument
1838 if (unix_passcred_enabled(sock, other)) { in maybe_add_creds()
1879 struct sock *sk = sock->sk, *other = NULL; in unix_dgram_sendmsg() local
1904 other = unix_peer_get(sk); in unix_dgram_sendmsg()
1905 if (!other) in unix_dgram_sendmsg()
1950 if (!other) { in unix_dgram_sendmsg()
1955 other = unix_find_other(sock_net(sk), sunaddr, msg->msg_namelen, in unix_dgram_sendmsg()
1957 if (IS_ERR(other)) { in unix_dgram_sendmsg()
1958 err = PTR_ERR(other); in unix_dgram_sendmsg()
1959 other = NULL; in unix_dgram_sendmsg()
1964 if (sk_filter(other, skb) < 0) { in unix_dgram_sendmsg()
1971 unix_state_lock(other); in unix_dgram_sendmsg()
1974 if (!unix_may_send(sk, other)) in unix_dgram_sendmsg()
1977 if (unlikely(sock_flag(other, SOCK_DEAD))) { in unix_dgram_sendmsg()
1982 unix_state_unlock(other); in unix_dgram_sendmsg()
1983 sock_put(other); in unix_dgram_sendmsg()
1991 * is clearing @other. Never change state to TCP_CLOSE in unix_dgram_sendmsg()
1996 } else if (unix_peer(sk) == other) { in unix_dgram_sendmsg()
1998 unix_dgram_peer_wake_disconnect_wakeup(sk, other); in unix_dgram_sendmsg()
2003 unix_dgram_disconnected(sk, other); in unix_dgram_sendmsg()
2004 sock_put(other); in unix_dgram_sendmsg()
2010 other = NULL; in unix_dgram_sendmsg()
2017 if (other->sk_shutdown & RCV_SHUTDOWN) in unix_dgram_sendmsg()
2021 err = security_unix_may_send(sk->sk_socket, other->sk_socket); in unix_dgram_sendmsg()
2026 /* other == sk && unix_peer(other) != sk if in unix_dgram_sendmsg()
2030 if (other != sk && in unix_dgram_sendmsg()
2031 unlikely(unix_peer(other) != sk && in unix_dgram_sendmsg()
2032 unix_recvq_full_lockless(other))) { in unix_dgram_sendmsg()
2034 timeo = unix_wait_for_peer(other, timeo); in unix_dgram_sendmsg()
2044 unix_state_unlock(other); in unix_dgram_sendmsg()
2045 unix_state_double_lock(sk, other); in unix_dgram_sendmsg()
2048 if (unix_peer(sk) != other || in unix_dgram_sendmsg()
2049 unix_dgram_peer_wake_me(sk, other)) { in unix_dgram_sendmsg()
2064 if (sock_flag(other, SOCK_RCVTSTAMP)) in unix_dgram_sendmsg()
2066 maybe_add_creds(skb, sock, other); in unix_dgram_sendmsg()
2067 scm_stat_add(other, skb); in unix_dgram_sendmsg()
2068 skb_queue_tail(&other->sk_receive_queue, skb); in unix_dgram_sendmsg()
2069 unix_state_unlock(other); in unix_dgram_sendmsg()
2070 other->sk_data_ready(other); in unix_dgram_sendmsg()
2071 sock_put(other); in unix_dgram_sendmsg()
2078 unix_state_unlock(other); in unix_dgram_sendmsg()
2082 if (other) in unix_dgram_sendmsg()
2083 sock_put(other); in unix_dgram_sendmsg()
2094 static int queue_oob(struct socket *sock, struct msghdr *msg, struct sock *other, in queue_oob() argument
2097 struct unix_sock *ousk = unix_sk(other); in queue_oob()
2119 unix_state_lock(other); in queue_oob()
2121 if (sock_flag(other, SOCK_DEAD) || in queue_oob()
2122 (other->sk_shutdown & RCV_SHUTDOWN)) { in queue_oob()
2123 unix_state_unlock(other); in queue_oob()
2128 maybe_add_creds(skb, sock, other); in queue_oob()
2131 scm_stat_add(other, skb); in queue_oob()
2133 spin_lock(&other->sk_receive_queue.lock); in queue_oob()
2137 __skb_queue_tail(&other->sk_receive_queue, skb); in queue_oob()
2138 spin_unlock(&other->sk_receive_queue.lock); in queue_oob()
2140 sk_send_sigurg(other); in queue_oob()
2141 unix_state_unlock(other); in queue_oob()
2142 other->sk_data_ready(other); in queue_oob()
2152 struct sock *other = NULL; in unix_stream_sendmsg() local
2180 other = unix_peer(sk); in unix_stream_sendmsg()
2181 if (!other) in unix_stream_sendmsg()
2242 unix_state_lock(other); in unix_stream_sendmsg()
2244 if (sock_flag(other, SOCK_DEAD) || in unix_stream_sendmsg()
2245 (other->sk_shutdown & RCV_SHUTDOWN)) in unix_stream_sendmsg()
2248 maybe_add_creds(skb, sock, other); in unix_stream_sendmsg()
2249 scm_stat_add(other, skb); in unix_stream_sendmsg()
2250 skb_queue_tail(&other->sk_receive_queue, skb); in unix_stream_sendmsg()
2251 unix_state_unlock(other); in unix_stream_sendmsg()
2252 other->sk_data_ready(other); in unix_stream_sendmsg()
2258 err = queue_oob(sock, msg, other, &scm, fds_sent); in unix_stream_sendmsg()
2270 unix_state_unlock(other); in unix_stream_sendmsg()
2943 struct sock *other; in unix_shutdown() local
2956 other = unix_peer(sk); in unix_shutdown()
2957 if (other) in unix_shutdown()
2958 sock_hold(other); in unix_shutdown()
2962 if (other && in unix_shutdown()
2966 const struct proto *prot = READ_ONCE(other->sk_prot); in unix_shutdown()
2969 prot->unhash(other); in unix_shutdown()
2974 unix_state_lock(other); in unix_shutdown()
2975 WRITE_ONCE(other->sk_shutdown, other->sk_shutdown | peer_mode); in unix_shutdown()
2976 unix_state_unlock(other); in unix_shutdown()
2977 other->sk_state_change(other); in unix_shutdown()
2979 sk_wake_async(other, SOCK_WAKE_WAITD, POLL_HUP); in unix_shutdown()
2981 sk_wake_async(other, SOCK_WAKE_WAITD, POLL_IN); in unix_shutdown()
2983 if (other) in unix_shutdown()
2984 sock_put(other); in unix_shutdown()
3139 * we set writable also when the other side has shut down the in unix_poll()
3151 struct sock *sk = sock->sk, *other; in unix_dgram_poll() local
3191 other = unix_peer(sk); in unix_dgram_poll()
3192 if (other && unix_peer(other) != sk && in unix_dgram_poll()
3193 unix_recvq_full_lockless(other) && in unix_dgram_poll()
3194 unix_dgram_peer_wake_me(sk, other)) in unix_dgram_poll()
3727 /* Earlier than device_initcall() so that other drivers invoking