Lines Matching refs:other
364 static int unix_dgram_peer_wake_connect(struct sock *sk, struct sock *other) in unix_dgram_peer_wake_connect() argument
370 u_other = unix_sk(other); in unix_dgram_peer_wake_connect()
375 u->peer_wake.private = other; in unix_dgram_peer_wake_connect()
386 struct sock *other) in unix_dgram_peer_wake_disconnect() argument
391 u_other = unix_sk(other); in unix_dgram_peer_wake_disconnect()
394 if (u->peer_wake.private == other) { in unix_dgram_peer_wake_disconnect()
403 struct sock *other) in unix_dgram_peer_wake_disconnect_wakeup() argument
405 unix_dgram_peer_wake_disconnect(sk, other); in unix_dgram_peer_wake_disconnect_wakeup()
416 static int unix_dgram_peer_wake_me(struct sock *sk, struct sock *other) in unix_dgram_peer_wake_me() argument
420 connected = unix_dgram_peer_wake_connect(sk, other); in unix_dgram_peer_wake_me()
422 if (unix_recvq_full(other)) in unix_dgram_peer_wake_me()
426 unix_dgram_peer_wake_disconnect(sk, other); in unix_dgram_peer_wake_me()
455 static void unix_dgram_disconnected(struct sock *sk, struct sock *other) in unix_dgram_disconnected() argument
465 if (!sock_flag(other, SOCK_DEAD) && unix_peer(other) == sk) { in unix_dgram_disconnected()
466 other->sk_err = ECONNRESET; in unix_dgram_disconnected()
467 other->sk_error_report(other); in unix_dgram_disconnected()
1083 struct sock *other; in unix_dgram_connect() local
1098 other = unix_find_other(net, sunaddr, alen, sock->type, hash, &err); in unix_dgram_connect()
1099 if (!other) in unix_dgram_connect()
1102 unix_state_double_lock(sk, other); in unix_dgram_connect()
1105 if (sock_flag(other, SOCK_DEAD)) { in unix_dgram_connect()
1106 unix_state_double_unlock(sk, other); in unix_dgram_connect()
1107 sock_put(other); in unix_dgram_connect()
1112 if (!unix_may_send(sk, other)) in unix_dgram_connect()
1115 err = security_unix_may_send(sk->sk_socket, other->sk_socket); in unix_dgram_connect()
1123 other = NULL; in unix_dgram_connect()
1124 unix_state_double_lock(sk, other); in unix_dgram_connect()
1132 unix_peer(sk) = other; in unix_dgram_connect()
1135 unix_state_double_unlock(sk, other); in unix_dgram_connect()
1137 if (other != old_peer) in unix_dgram_connect()
1141 unix_peer(sk) = other; in unix_dgram_connect()
1142 unix_state_double_unlock(sk, other); in unix_dgram_connect()
1147 unix_state_double_unlock(sk, other); in unix_dgram_connect()
1148 sock_put(other); in unix_dgram_connect()
1153 static long unix_wait_for_peer(struct sock *other, long timeo) in unix_wait_for_peer() argument
1155 struct unix_sock *u = unix_sk(other); in unix_wait_for_peer()
1161 sched = !sock_flag(other, SOCK_DEAD) && in unix_wait_for_peer()
1162 !(other->sk_shutdown & RCV_SHUTDOWN) && in unix_wait_for_peer()
1163 unix_recvq_full(other); in unix_wait_for_peer()
1165 unix_state_unlock(other); in unix_wait_for_peer()
1182 struct sock *other = NULL; in unix_stream_connect() local
1219 other = unix_find_other(net, sunaddr, addr_len, sk->sk_type, hash, &err); in unix_stream_connect()
1220 if (!other) in unix_stream_connect()
1224 unix_state_lock(other); in unix_stream_connect()
1227 if (sock_flag(other, SOCK_DEAD)) { in unix_stream_connect()
1228 unix_state_unlock(other); in unix_stream_connect()
1229 sock_put(other); in unix_stream_connect()
1234 if (other->sk_state != TCP_LISTEN) in unix_stream_connect()
1236 if (other->sk_shutdown & RCV_SHUTDOWN) in unix_stream_connect()
1239 if (unix_recvq_full(other)) { in unix_stream_connect()
1244 timeo = unix_wait_for_peer(other, timeo); in unix_stream_connect()
1249 sock_put(other); in unix_stream_connect()
1283 unix_state_unlock(other); in unix_stream_connect()
1284 sock_put(other); in unix_stream_connect()
1288 err = security_unix_stream_connect(sk, other, newsk); in unix_stream_connect()
1303 otheru = unix_sk(other); in unix_stream_connect()
1316 copy_peercred(sk, other); in unix_stream_connect()
1328 spin_lock(&other->sk_receive_queue.lock); in unix_stream_connect()
1329 __skb_queue_tail(&other->sk_receive_queue, skb); in unix_stream_connect()
1330 spin_unlock(&other->sk_receive_queue.lock); in unix_stream_connect()
1331 unix_state_unlock(other); in unix_stream_connect()
1332 other->sk_data_ready(other); in unix_stream_connect()
1333 sock_put(other); in unix_stream_connect()
1337 if (other) in unix_stream_connect()
1338 unix_state_unlock(other); in unix_stream_connect()
1344 if (other) in unix_stream_connect()
1345 sock_put(other); in unix_stream_connect()
1557 const struct sock *other) in maybe_add_creds() argument
1562 !other->sk_socket || in maybe_add_creds()
1563 test_bit(SOCK_PASSCRED, &other->sk_socket->flags)) { in maybe_add_creds()
1580 struct sock *other = NULL; in unix_dgram_sendmsg() local
1608 other = unix_peer_get(sk); in unix_dgram_sendmsg()
1609 if (!other) in unix_dgram_sendmsg()
1652 if (!other) { in unix_dgram_sendmsg()
1657 other = unix_find_other(net, sunaddr, namelen, sk->sk_type, in unix_dgram_sendmsg()
1659 if (other == NULL) in unix_dgram_sendmsg()
1663 if (sk_filter(other, skb) < 0) { in unix_dgram_sendmsg()
1670 unix_state_lock(other); in unix_dgram_sendmsg()
1673 if (!unix_may_send(sk, other)) in unix_dgram_sendmsg()
1676 if (unlikely(sock_flag(other, SOCK_DEAD))) { in unix_dgram_sendmsg()
1681 unix_state_unlock(other); in unix_dgram_sendmsg()
1682 sock_put(other); in unix_dgram_sendmsg()
1688 if (unix_peer(sk) == other) { in unix_dgram_sendmsg()
1690 unix_dgram_peer_wake_disconnect_wakeup(sk, other); in unix_dgram_sendmsg()
1694 unix_dgram_disconnected(sk, other); in unix_dgram_sendmsg()
1695 sock_put(other); in unix_dgram_sendmsg()
1701 other = NULL; in unix_dgram_sendmsg()
1708 if (other->sk_shutdown & RCV_SHUTDOWN) in unix_dgram_sendmsg()
1712 err = security_unix_may_send(sk->sk_socket, other->sk_socket); in unix_dgram_sendmsg()
1721 if (other != sk && in unix_dgram_sendmsg()
1722 unlikely(unix_peer(other) != sk && unix_recvq_full(other))) { in unix_dgram_sendmsg()
1724 timeo = unix_wait_for_peer(other, timeo); in unix_dgram_sendmsg()
1734 unix_state_unlock(other); in unix_dgram_sendmsg()
1735 unix_state_double_lock(sk, other); in unix_dgram_sendmsg()
1738 if (unix_peer(sk) != other || in unix_dgram_sendmsg()
1739 unix_dgram_peer_wake_me(sk, other)) { in unix_dgram_sendmsg()
1754 if (sock_flag(other, SOCK_RCVTSTAMP)) in unix_dgram_sendmsg()
1756 maybe_add_creds(skb, sock, other); in unix_dgram_sendmsg()
1757 skb_queue_tail(&other->sk_receive_queue, skb); in unix_dgram_sendmsg()
1758 if (max_level > unix_sk(other)->recursion_level) in unix_dgram_sendmsg()
1759 unix_sk(other)->recursion_level = max_level; in unix_dgram_sendmsg()
1760 unix_state_unlock(other); in unix_dgram_sendmsg()
1761 other->sk_data_ready(other); in unix_dgram_sendmsg()
1762 sock_put(other); in unix_dgram_sendmsg()
1769 unix_state_unlock(other); in unix_dgram_sendmsg()
1773 if (other) in unix_dgram_sendmsg()
1774 sock_put(other); in unix_dgram_sendmsg()
1788 struct sock *other = NULL; in unix_stream_sendmsg() local
1811 other = unix_peer(sk); in unix_stream_sendmsg()
1812 if (!other) in unix_stream_sendmsg()
1856 unix_state_lock(other); in unix_stream_sendmsg()
1858 if (sock_flag(other, SOCK_DEAD) || in unix_stream_sendmsg()
1859 (other->sk_shutdown & RCV_SHUTDOWN)) in unix_stream_sendmsg()
1862 maybe_add_creds(skb, sock, other); in unix_stream_sendmsg()
1863 skb_queue_tail(&other->sk_receive_queue, skb); in unix_stream_sendmsg()
1864 if (max_level > unix_sk(other)->recursion_level) in unix_stream_sendmsg()
1865 unix_sk(other)->recursion_level = max_level; in unix_stream_sendmsg()
1866 unix_state_unlock(other); in unix_stream_sendmsg()
1867 other->sk_data_ready(other); in unix_stream_sendmsg()
1876 unix_state_unlock(other); in unix_stream_sendmsg()
2236 struct sock *other; in unix_shutdown() local
2249 other = unix_peer(sk); in unix_shutdown()
2250 if (other) in unix_shutdown()
2251 sock_hold(other); in unix_shutdown()
2255 if (other && in unix_shutdown()
2264 unix_state_lock(other); in unix_shutdown()
2265 other->sk_shutdown |= peer_mode; in unix_shutdown()
2266 unix_state_unlock(other); in unix_shutdown()
2267 other->sk_state_change(other); in unix_shutdown()
2269 sk_wake_async(other, SOCK_WAKE_WAITD, POLL_HUP); in unix_shutdown()
2271 sk_wake_async(other, SOCK_WAKE_WAITD, POLL_IN); in unix_shutdown()
2273 if (other) in unix_shutdown()
2274 sock_put(other); in unix_shutdown()
2372 struct sock *sk = sock->sk, *other; in unix_dgram_poll() local
2409 other = unix_peer(sk); in unix_dgram_poll()
2410 if (other && unix_peer(other) != sk && in unix_dgram_poll()
2411 unix_recvq_full(other) && in unix_dgram_poll()
2412 unix_dgram_peer_wake_me(sk, other)) in unix_dgram_poll()