Lines Matching refs:other
378 static int unix_dgram_peer_wake_connect(struct sock *sk, struct sock *other) in unix_dgram_peer_wake_connect() argument
384 u_other = unix_sk(other); in unix_dgram_peer_wake_connect()
389 u->peer_wake.private = other; in unix_dgram_peer_wake_connect()
400 struct sock *other) in unix_dgram_peer_wake_disconnect() argument
405 u_other = unix_sk(other); in unix_dgram_peer_wake_disconnect()
408 if (u->peer_wake.private == other) { in unix_dgram_peer_wake_disconnect()
417 struct sock *other) in unix_dgram_peer_wake_disconnect_wakeup() argument
419 unix_dgram_peer_wake_disconnect(sk, other); in unix_dgram_peer_wake_disconnect_wakeup()
430 static int unix_dgram_peer_wake_me(struct sock *sk, struct sock *other) in unix_dgram_peer_wake_me() argument
434 connected = unix_dgram_peer_wake_connect(sk, other); in unix_dgram_peer_wake_me()
441 if (unix_recvq_full_lockless(other) && !sock_flag(other, SOCK_DEAD)) in unix_dgram_peer_wake_me()
445 unix_dgram_peer_wake_disconnect(sk, other); in unix_dgram_peer_wake_me()
475 static void unix_dgram_disconnected(struct sock *sk, struct sock *other) in unix_dgram_disconnected() argument
485 if (!sock_flag(other, SOCK_DEAD) && unix_peer(other) == sk) { in unix_dgram_disconnected()
486 other->sk_err = ECONNRESET; in unix_dgram_disconnected()
487 other->sk_error_report(other); in unix_dgram_disconnected()
1152 struct sock *other; in unix_dgram_connect() local
1171 other = unix_find_other(net, sunaddr, alen, sock->type, hash, &err); in unix_dgram_connect()
1172 if (!other) in unix_dgram_connect()
1175 unix_state_double_lock(sk, other); in unix_dgram_connect()
1178 if (sock_flag(other, SOCK_DEAD)) { in unix_dgram_connect()
1179 unix_state_double_unlock(sk, other); in unix_dgram_connect()
1180 sock_put(other); in unix_dgram_connect()
1185 if (!unix_may_send(sk, other)) in unix_dgram_connect()
1188 err = security_unix_may_send(sk->sk_socket, other->sk_socket); in unix_dgram_connect()
1196 other = NULL; in unix_dgram_connect()
1197 unix_state_double_lock(sk, other); in unix_dgram_connect()
1205 unix_peer(sk) = other; in unix_dgram_connect()
1208 unix_state_double_unlock(sk, other); in unix_dgram_connect()
1210 if (other != old_peer) in unix_dgram_connect()
1214 unix_peer(sk) = other; in unix_dgram_connect()
1215 unix_state_double_unlock(sk, other); in unix_dgram_connect()
1220 unix_state_double_unlock(sk, other); in unix_dgram_connect()
1221 sock_put(other); in unix_dgram_connect()
1226 static long unix_wait_for_peer(struct sock *other, long timeo) in unix_wait_for_peer() argument
1227 __releases(&unix_sk(other)->lock) in unix_wait_for_peer()
1229 struct unix_sock *u = unix_sk(other); in unix_wait_for_peer()
1235 sched = !sock_flag(other, SOCK_DEAD) && in unix_wait_for_peer()
1236 !(other->sk_shutdown & RCV_SHUTDOWN) && in unix_wait_for_peer()
1237 unix_recvq_full_lockless(other); in unix_wait_for_peer()
1239 unix_state_unlock(other); in unix_wait_for_peer()
1256 struct sock *other = NULL; in unix_stream_connect() local
1293 other = unix_find_other(net, sunaddr, addr_len, sk->sk_type, hash, &err); in unix_stream_connect()
1294 if (!other) in unix_stream_connect()
1298 unix_state_lock(other); in unix_stream_connect()
1301 if (sock_flag(other, SOCK_DEAD)) { in unix_stream_connect()
1302 unix_state_unlock(other); in unix_stream_connect()
1303 sock_put(other); in unix_stream_connect()
1308 if (other->sk_state != TCP_LISTEN) in unix_stream_connect()
1310 if (other->sk_shutdown & RCV_SHUTDOWN) in unix_stream_connect()
1313 if (unix_recvq_full(other)) { in unix_stream_connect()
1318 timeo = unix_wait_for_peer(other, timeo); in unix_stream_connect()
1323 sock_put(other); in unix_stream_connect()
1357 unix_state_unlock(other); in unix_stream_connect()
1358 sock_put(other); in unix_stream_connect()
1362 err = security_unix_stream_connect(sk, other, newsk); in unix_stream_connect()
1377 otheru = unix_sk(other); in unix_stream_connect()
1404 copy_peercred(sk, other); in unix_stream_connect()
1416 spin_lock(&other->sk_receive_queue.lock); in unix_stream_connect()
1417 __skb_queue_tail(&other->sk_receive_queue, skb); in unix_stream_connect()
1418 spin_unlock(&other->sk_receive_queue.lock); in unix_stream_connect()
1419 unix_state_unlock(other); in unix_stream_connect()
1420 other->sk_data_ready(other); in unix_stream_connect()
1421 sock_put(other); in unix_stream_connect()
1425 if (other) in unix_stream_connect()
1426 unix_state_unlock(other); in unix_stream_connect()
1432 if (other) in unix_stream_connect()
1433 sock_put(other); in unix_stream_connect()
1608 const struct sock *other) in unix_passcred_enabled() argument
1611 !other->sk_socket || in unix_passcred_enabled()
1612 test_bit(SOCK_PASSCRED, &other->sk_socket->flags); in unix_passcred_enabled()
1621 const struct sock *other) in maybe_add_creds() argument
1625 if (unix_passcred_enabled(sock, other)) { in maybe_add_creds()
1633 const struct sock *other) in maybe_init_creds() argument
1642 if (unix_passcred_enabled(socket, other)) { in maybe_init_creds()
1689 struct sock *other = NULL; in unix_dgram_sendmsg() local
1716 other = unix_peer_get(sk); in unix_dgram_sendmsg()
1717 if (!other) in unix_dgram_sendmsg()
1758 if (!other) { in unix_dgram_sendmsg()
1763 other = unix_find_other(net, sunaddr, namelen, sk->sk_type, in unix_dgram_sendmsg()
1765 if (other == NULL) in unix_dgram_sendmsg()
1769 if (sk_filter(other, skb) < 0) { in unix_dgram_sendmsg()
1776 unix_state_lock(other); in unix_dgram_sendmsg()
1779 if (!unix_may_send(sk, other)) in unix_dgram_sendmsg()
1782 if (unlikely(sock_flag(other, SOCK_DEAD))) { in unix_dgram_sendmsg()
1787 unix_state_unlock(other); in unix_dgram_sendmsg()
1788 sock_put(other); in unix_dgram_sendmsg()
1794 if (unix_peer(sk) == other) { in unix_dgram_sendmsg()
1796 unix_dgram_peer_wake_disconnect_wakeup(sk, other); in unix_dgram_sendmsg()
1800 unix_dgram_disconnected(sk, other); in unix_dgram_sendmsg()
1801 sock_put(other); in unix_dgram_sendmsg()
1807 other = NULL; in unix_dgram_sendmsg()
1814 if (other->sk_shutdown & RCV_SHUTDOWN) in unix_dgram_sendmsg()
1818 err = security_unix_may_send(sk->sk_socket, other->sk_socket); in unix_dgram_sendmsg()
1827 if (other != sk && in unix_dgram_sendmsg()
1828 unlikely(unix_peer(other) != sk && in unix_dgram_sendmsg()
1829 unix_recvq_full_lockless(other))) { in unix_dgram_sendmsg()
1831 timeo = unix_wait_for_peer(other, timeo); in unix_dgram_sendmsg()
1841 unix_state_unlock(other); in unix_dgram_sendmsg()
1842 unix_state_double_lock(sk, other); in unix_dgram_sendmsg()
1845 if (unix_peer(sk) != other || in unix_dgram_sendmsg()
1846 unix_dgram_peer_wake_me(sk, other)) { in unix_dgram_sendmsg()
1861 if (sock_flag(other, SOCK_RCVTSTAMP)) in unix_dgram_sendmsg()
1863 maybe_add_creds(skb, sock, other); in unix_dgram_sendmsg()
1864 scm_stat_add(other, skb); in unix_dgram_sendmsg()
1865 skb_queue_tail(&other->sk_receive_queue, skb); in unix_dgram_sendmsg()
1866 unix_state_unlock(other); in unix_dgram_sendmsg()
1867 other->sk_data_ready(other); in unix_dgram_sendmsg()
1868 sock_put(other); in unix_dgram_sendmsg()
1875 unix_state_unlock(other); in unix_dgram_sendmsg()
1879 if (other) in unix_dgram_sendmsg()
1880 sock_put(other); in unix_dgram_sendmsg()
1894 struct sock *other = NULL; in unix_stream_sendmsg() local
1916 other = unix_peer(sk); in unix_stream_sendmsg()
1917 if (!other) in unix_stream_sendmsg()
1960 unix_state_lock(other); in unix_stream_sendmsg()
1962 if (sock_flag(other, SOCK_DEAD) || in unix_stream_sendmsg()
1963 (other->sk_shutdown & RCV_SHUTDOWN)) in unix_stream_sendmsg()
1966 maybe_add_creds(skb, sock, other); in unix_stream_sendmsg()
1967 scm_stat_add(other, skb); in unix_stream_sendmsg()
1968 skb_queue_tail(&other->sk_receive_queue, skb); in unix_stream_sendmsg()
1969 unix_state_unlock(other); in unix_stream_sendmsg()
1970 other->sk_data_ready(other); in unix_stream_sendmsg()
1979 unix_state_unlock(other); in unix_stream_sendmsg()
1997 struct sock *other, *sk = socket->sk; in unix_stream_sendpage() local
2003 other = unix_peer(sk); in unix_stream_sendpage()
2004 if (!other || sk->sk_state != TCP_ESTABLISHED) in unix_stream_sendpage()
2009 spin_unlock(&other->sk_receive_queue.lock); in unix_stream_sendpage()
2010 unix_state_unlock(other); in unix_stream_sendpage()
2011 mutex_unlock(&unix_sk(other)->iolock); in unix_stream_sendpage()
2021 err = mutex_lock_interruptible(&unix_sk(other)->iolock); in unix_stream_sendpage()
2033 unix_state_lock(other); in unix_stream_sendpage()
2035 if (sock_flag(other, SOCK_DEAD) || in unix_stream_sendpage()
2036 other->sk_shutdown & RCV_SHUTDOWN) { in unix_stream_sendpage()
2043 err = maybe_init_creds(&scm, socket, other); in unix_stream_sendpage()
2049 spin_lock(&other->sk_receive_queue.lock); in unix_stream_sendpage()
2050 skb = skb_peek_tail(&other->sk_receive_queue); in unix_stream_sendpage()
2081 __skb_queue_tail(&other->sk_receive_queue, newskb); in unix_stream_sendpage()
2084 spin_unlock(&other->sk_receive_queue.lock); in unix_stream_sendpage()
2085 unix_state_unlock(other); in unix_stream_sendpage()
2086 mutex_unlock(&unix_sk(other)->iolock); in unix_stream_sendpage()
2088 other->sk_data_ready(other); in unix_stream_sendpage()
2093 unix_state_unlock(other); in unix_stream_sendpage()
2095 mutex_unlock(&unix_sk(other)->iolock); in unix_stream_sendpage()
2569 struct sock *other; in unix_shutdown() local
2582 other = unix_peer(sk); in unix_shutdown()
2583 if (other) in unix_shutdown()
2584 sock_hold(other); in unix_shutdown()
2588 if (other && in unix_shutdown()
2597 unix_state_lock(other); in unix_shutdown()
2598 WRITE_ONCE(other->sk_shutdown, other->sk_shutdown | peer_mode); in unix_shutdown()
2599 unix_state_unlock(other); in unix_shutdown()
2600 other->sk_state_change(other); in unix_shutdown()
2602 sk_wake_async(other, SOCK_WAKE_WAITD, POLL_HUP); in unix_shutdown()
2604 sk_wake_async(other, SOCK_WAKE_WAITD, POLL_IN); in unix_shutdown()
2606 if (other) in unix_shutdown()
2607 sock_put(other); in unix_shutdown()
2753 struct sock *sk = sock->sk, *other; in unix_dgram_poll() local
2793 other = unix_peer(sk); in unix_dgram_poll()
2794 if (other && unix_peer(other) != sk && in unix_dgram_poll()
2795 unix_recvq_full_lockless(other) && in unix_dgram_poll()
2796 unix_dgram_peer_wake_me(sk, other)) in unix_dgram_poll()