• Home
  • Raw
  • Download

Lines Matching full:other

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