Lines Matching refs:other
52 * other the moment one end closes.
462 static int unix_dgram_peer_wake_connect(struct sock *sk, struct sock *other)
468 u_other = unix_sk(other);
473 u->peer_wake.private = other;
484 struct sock *other)
489 u_other = unix_sk(other);
492 if (u->peer_wake.private == other) {
501 struct sock *other)
503 unix_dgram_peer_wake_disconnect(sk, other);
511 * - unix_peer(sk) == other
514 static int unix_dgram_peer_wake_me(struct sock *sk, struct sock *other)
518 connected = unix_dgram_peer_wake_connect(sk, other);
520 /* If other is SOCK_DEAD, we want to make sure we signal
523 * to other and its full, we will hang waiting for POLLOUT.
525 if (unix_recvq_full_lockless(other) && !sock_flag(other, SOCK_DEAD))
529 unix_dgram_peer_wake_disconnect(sk, other);
559 static void unix_dgram_disconnected(struct sock *sk, struct sock *other)
569 if (!sock_flag(other, SOCK_DEAD) && unix_peer(other) == sk) {
570 WRITE_ONCE(other->sk_err, ECONNRESET);
571 sk_error_report(other);
574 other->sk_state = TCP_CLOSE;
1368 struct sock *other;
1389 other = unix_find_other(sock_net(sk), sunaddr, alen, sock->type);
1390 if (IS_ERR(other)) {
1391 err = PTR_ERR(other);
1395 unix_state_double_lock(sk, other);
1398 if (sock_flag(other, SOCK_DEAD)) {
1399 unix_state_double_unlock(sk, other);
1400 sock_put(other);
1405 if (!unix_may_send(sk, other))
1408 err = security_unix_may_send(sk->sk_socket, other->sk_socket);
1412 sk->sk_state = other->sk_state = TCP_ESTABLISHED;
1417 other = NULL;
1418 unix_state_double_lock(sk, other);
1427 unix_peer(sk) = other;
1428 if (!other)
1432 unix_state_double_unlock(sk, other);
1434 if (other != old_peer)
1438 unix_peer(sk) = other;
1439 unix_state_double_unlock(sk, other);
1445 unix_state_double_unlock(sk, other);
1446 sock_put(other);
1451 static long unix_wait_for_peer(struct sock *other, long timeo)
1452 __releases(&unix_sk(other)->lock)
1454 struct unix_sock *u = unix_sk(other);
1460 sched = !sock_flag(other, SOCK_DEAD) &&
1461 !(other->sk_shutdown & RCV_SHUTDOWN) &&
1462 unix_recvq_full_lockless(other);
1464 unix_state_unlock(other);
1477 struct sock *sk = sock->sk, *newsk = NULL, *other = NULL;
1520 other = unix_find_other(net, sunaddr, addr_len, sk->sk_type);
1521 if (IS_ERR(other)) {
1522 err = PTR_ERR(other);
1523 other = NULL;
1528 unix_state_lock(other);
1531 if (sock_flag(other, SOCK_DEAD)) {
1532 unix_state_unlock(other);
1533 sock_put(other);
1538 if (other->sk_state != TCP_LISTEN)
1540 if (other->sk_shutdown & RCV_SHUTDOWN)
1543 if (unix_recvq_full(other)) {
1548 timeo = unix_wait_for_peer(other, timeo);
1553 sock_put(other);
1563 state. other is TCP_LISTEN, if sk is TCP_LISTEN we
1587 unix_state_unlock(other);
1588 sock_put(other);
1592 err = security_unix_stream_connect(sk, other, newsk);
1607 otheru = unix_sk(other);
1634 copy_peercred(sk, other);
1646 spin_lock(&other->sk_receive_queue.lock);
1647 __skb_queue_tail(&other->sk_receive_queue, skb);
1648 spin_unlock(&other->sk_receive_queue.lock);
1649 unix_state_unlock(other);
1650 other->sk_data_ready(other);
1651 sock_put(other);
1655 if (other)
1656 unix_state_unlock(other);
1662 if (other)
1663 sock_put(other);
1839 const struct sock *other)
1843 !other->sk_socket ||
1844 test_bit(SOCK_PASSCRED, &other->sk_socket->flags) ||
1845 test_bit(SOCK_PASSPIDFD, &other->sk_socket->flags);
1854 const struct sock *other)
1858 if (unix_passcred_enabled(sock, other)) {
1899 struct sock *sk = sock->sk, *other = NULL;
1924 other = unix_peer_get(sk);
1925 if (!other)
1969 if (!other) {
1974 other = unix_find_other(sock_net(sk), sunaddr, msg->msg_namelen,
1976 if (IS_ERR(other)) {
1977 err = PTR_ERR(other);
1978 other = NULL;
1983 if (sk_filter(other, skb) < 0) {
1990 unix_state_lock(other);
1993 if (!unix_may_send(sk, other))
1996 if (unlikely(sock_flag(other, SOCK_DEAD))) {
2001 unix_state_unlock(other);
2002 sock_put(other);
2010 * is clearing @other. Never change state to TCP_CLOSE
2015 } else if (unix_peer(sk) == other) {
2017 unix_dgram_peer_wake_disconnect_wakeup(sk, other);
2022 unix_dgram_disconnected(sk, other);
2023 sock_put(other);
2029 other = NULL;
2036 if (other->sk_shutdown & RCV_SHUTDOWN)
2040 err = security_unix_may_send(sk->sk_socket, other->sk_socket);
2045 /* other == sk && unix_peer(other) != sk if
2049 if (other != sk &&
2050 unlikely(unix_peer(other) != sk &&
2051 unix_recvq_full_lockless(other))) {
2053 timeo = unix_wait_for_peer(other, timeo);
2063 unix_state_unlock(other);
2064 unix_state_double_lock(sk, other);
2067 if (unix_peer(sk) != other ||
2068 unix_dgram_peer_wake_me(sk, other)) {
2083 if (sock_flag(other, SOCK_RCVTSTAMP))
2085 maybe_add_creds(skb, sock, other);
2086 scm_stat_add(other, skb);
2087 skb_queue_tail(&other->sk_receive_queue, skb);
2088 unix_state_unlock(other);
2089 other->sk_data_ready(other);
2090 sock_put(other);
2097 unix_state_unlock(other);
2101 if (other)
2102 sock_put(other);
2113 static int queue_oob(struct socket *sock, struct msghdr *msg, struct sock *other,
2116 struct unix_sock *ousk = unix_sk(other);
2138 unix_state_lock(other);
2140 if (sock_flag(other, SOCK_DEAD) ||
2141 (other->sk_shutdown & RCV_SHUTDOWN)) {
2142 unix_state_unlock(other);
2147 maybe_add_creds(skb, sock, other);
2155 scm_stat_add(other, skb);
2156 skb_queue_tail(&other->sk_receive_queue, skb);
2157 sk_send_sigurg(other);
2158 unix_state_unlock(other);
2159 other->sk_data_ready(other);
2169 struct sock *other = NULL;
2197 other = unix_peer(sk);
2198 if (!other)
2258 unix_state_lock(other);
2260 if (sock_flag(other, SOCK_DEAD) ||
2261 (other->sk_shutdown & RCV_SHUTDOWN))
2264 maybe_add_creds(skb, sock, other);
2265 scm_stat_add(other, skb);
2266 skb_queue_tail(&other->sk_receive_queue, skb);
2267 unix_state_unlock(other);
2268 other->sk_data_ready(other);
2274 err = queue_oob(sock, msg, other, &scm, fds_sent);
2286 unix_state_unlock(other);
2904 struct sock *other;
2917 other = unix_peer(sk);
2918 if (other)
2919 sock_hold(other);
2923 if (other &&
2927 const struct proto *prot = READ_ONCE(other->sk_prot);
2930 prot->unhash(other);
2935 unix_state_lock(other);
2936 WRITE_ONCE(other->sk_shutdown, other->sk_shutdown | peer_mode);
2937 unix_state_unlock(other);
2938 other->sk_state_change(other);
2940 sk_wake_async(other, SOCK_WAKE_WAITD, POLL_HUP);
2942 sk_wake_async(other, SOCK_WAKE_WAITD, POLL_IN);
2944 if (other)
2945 sock_put(other);
3098 * we set writable also when the other side has shut down the
3110 struct sock *sk = sock->sk, *other;
3153 other = unix_peer(sk);
3154 if (other && unix_peer(other) != sk &&
3155 unix_recvq_full_lockless(other) &&
3156 unix_dgram_peer_wake_me(sk, other))
3689 /* Earlier than device_initcall() so that other drivers invoking