Lines Matching refs:other

374 static int unix_dgram_peer_wake_connect(struct sock *sk, struct sock *other)  in unix_dgram_peer_wake_connect()  argument
380 u_other = unix_sk(other); in unix_dgram_peer_wake_connect()
385 u->peer_wake.private = other; in unix_dgram_peer_wake_connect()
396 struct sock *other) in unix_dgram_peer_wake_disconnect() argument
401 u_other = unix_sk(other); in unix_dgram_peer_wake_disconnect()
404 if (u->peer_wake.private == other) { in unix_dgram_peer_wake_disconnect()
413 struct sock *other) in unix_dgram_peer_wake_disconnect_wakeup() argument
415 unix_dgram_peer_wake_disconnect(sk, other); in unix_dgram_peer_wake_disconnect_wakeup()
426 static int unix_dgram_peer_wake_me(struct sock *sk, struct sock *other) in unix_dgram_peer_wake_me() argument
430 connected = unix_dgram_peer_wake_connect(sk, other); in unix_dgram_peer_wake_me()
432 if (unix_recvq_full(other)) in unix_dgram_peer_wake_me()
436 unix_dgram_peer_wake_disconnect(sk, other); in unix_dgram_peer_wake_me()
466 static void unix_dgram_disconnected(struct sock *sk, struct sock *other) in unix_dgram_disconnected() argument
476 if (!sock_flag(other, SOCK_DEAD) && unix_peer(other) == sk) { in unix_dgram_disconnected()
477 other->sk_err = ECONNRESET; in unix_dgram_disconnected()
478 other->sk_error_report(other); in unix_dgram_disconnected()
1115 struct sock *other; in unix_dgram_connect() local
1130 other = unix_find_other(net, sunaddr, alen, sock->type, hash, &err); in unix_dgram_connect()
1131 if (!other) in unix_dgram_connect()
1134 unix_state_double_lock(sk, other); in unix_dgram_connect()
1137 if (sock_flag(other, SOCK_DEAD)) { in unix_dgram_connect()
1138 unix_state_double_unlock(sk, other); in unix_dgram_connect()
1139 sock_put(other); in unix_dgram_connect()
1144 if (!unix_may_send(sk, other)) in unix_dgram_connect()
1147 err = security_unix_may_send(sk->sk_socket, other->sk_socket); in unix_dgram_connect()
1155 other = NULL; in unix_dgram_connect()
1156 unix_state_double_lock(sk, other); in unix_dgram_connect()
1164 unix_peer(sk) = other; in unix_dgram_connect()
1167 unix_state_double_unlock(sk, other); in unix_dgram_connect()
1169 if (other != old_peer) in unix_dgram_connect()
1173 unix_peer(sk) = other; in unix_dgram_connect()
1174 unix_state_double_unlock(sk, other); in unix_dgram_connect()
1179 unix_state_double_unlock(sk, other); in unix_dgram_connect()
1180 sock_put(other); in unix_dgram_connect()
1185 static long unix_wait_for_peer(struct sock *other, long timeo) in unix_wait_for_peer() argument
1187 struct unix_sock *u = unix_sk(other); in unix_wait_for_peer()
1193 sched = !sock_flag(other, SOCK_DEAD) && in unix_wait_for_peer()
1194 !(other->sk_shutdown & RCV_SHUTDOWN) && in unix_wait_for_peer()
1195 unix_recvq_full(other); in unix_wait_for_peer()
1197 unix_state_unlock(other); in unix_wait_for_peer()
1214 struct sock *other = NULL; in unix_stream_connect() local
1251 other = unix_find_other(net, sunaddr, addr_len, sk->sk_type, hash, &err); in unix_stream_connect()
1252 if (!other) in unix_stream_connect()
1256 unix_state_lock(other); in unix_stream_connect()
1259 if (sock_flag(other, SOCK_DEAD)) { in unix_stream_connect()
1260 unix_state_unlock(other); in unix_stream_connect()
1261 sock_put(other); in unix_stream_connect()
1266 if (other->sk_state != TCP_LISTEN) in unix_stream_connect()
1268 if (other->sk_shutdown & RCV_SHUTDOWN) in unix_stream_connect()
1271 if (unix_recvq_full(other)) { in unix_stream_connect()
1276 timeo = unix_wait_for_peer(other, timeo); in unix_stream_connect()
1281 sock_put(other); in unix_stream_connect()
1315 unix_state_unlock(other); in unix_stream_connect()
1316 sock_put(other); in unix_stream_connect()
1320 err = security_unix_stream_connect(sk, other, newsk); in unix_stream_connect()
1335 otheru = unix_sk(other); in unix_stream_connect()
1348 copy_peercred(sk, other); in unix_stream_connect()
1360 spin_lock(&other->sk_receive_queue.lock); in unix_stream_connect()
1361 __skb_queue_tail(&other->sk_receive_queue, skb); in unix_stream_connect()
1362 spin_unlock(&other->sk_receive_queue.lock); in unix_stream_connect()
1363 unix_state_unlock(other); in unix_stream_connect()
1364 other->sk_data_ready(other); in unix_stream_connect()
1365 sock_put(other); in unix_stream_connect()
1369 if (other) in unix_stream_connect()
1370 unix_state_unlock(other); in unix_stream_connect()
1376 if (other) in unix_stream_connect()
1377 sock_put(other); in unix_stream_connect()
1585 const struct sock *other) in unix_passcred_enabled() argument
1588 !other->sk_socket || in unix_passcred_enabled()
1589 test_bit(SOCK_PASSCRED, &other->sk_socket->flags); in unix_passcred_enabled()
1598 const struct sock *other) in maybe_add_creds() argument
1602 if (unix_passcred_enabled(sock, other)) { in maybe_add_creds()
1610 const struct sock *other) in maybe_init_creds() argument
1619 if (unix_passcred_enabled(socket, other)) { in maybe_init_creds()
1648 struct sock *other = NULL; in unix_dgram_sendmsg() local
1676 other = unix_peer_get(sk); in unix_dgram_sendmsg()
1677 if (!other) in unix_dgram_sendmsg()
1719 if (!other) { in unix_dgram_sendmsg()
1724 other = unix_find_other(net, sunaddr, namelen, sk->sk_type, in unix_dgram_sendmsg()
1726 if (other == NULL) in unix_dgram_sendmsg()
1730 if (sk_filter(other, skb) < 0) { in unix_dgram_sendmsg()
1737 unix_state_lock(other); in unix_dgram_sendmsg()
1740 if (!unix_may_send(sk, other)) in unix_dgram_sendmsg()
1743 if (unlikely(sock_flag(other, SOCK_DEAD))) { in unix_dgram_sendmsg()
1748 unix_state_unlock(other); in unix_dgram_sendmsg()
1749 sock_put(other); in unix_dgram_sendmsg()
1755 if (unix_peer(sk) == other) { in unix_dgram_sendmsg()
1757 unix_dgram_peer_wake_disconnect_wakeup(sk, other); in unix_dgram_sendmsg()
1761 unix_dgram_disconnected(sk, other); in unix_dgram_sendmsg()
1762 sock_put(other); in unix_dgram_sendmsg()
1768 other = NULL; in unix_dgram_sendmsg()
1775 if (other->sk_shutdown & RCV_SHUTDOWN) in unix_dgram_sendmsg()
1779 err = security_unix_may_send(sk->sk_socket, other->sk_socket); in unix_dgram_sendmsg()
1788 if (other != sk && in unix_dgram_sendmsg()
1789 unlikely(unix_peer(other) != sk && unix_recvq_full(other))) { in unix_dgram_sendmsg()
1791 timeo = unix_wait_for_peer(other, timeo); in unix_dgram_sendmsg()
1801 unix_state_unlock(other); in unix_dgram_sendmsg()
1802 unix_state_double_lock(sk, other); in unix_dgram_sendmsg()
1805 if (unix_peer(sk) != other || in unix_dgram_sendmsg()
1806 unix_dgram_peer_wake_me(sk, other)) { in unix_dgram_sendmsg()
1821 if (sock_flag(other, SOCK_RCVTSTAMP)) in unix_dgram_sendmsg()
1823 maybe_add_creds(skb, sock, other); in unix_dgram_sendmsg()
1824 skb_queue_tail(&other->sk_receive_queue, skb); in unix_dgram_sendmsg()
1825 if (max_level > unix_sk(other)->recursion_level) in unix_dgram_sendmsg()
1826 unix_sk(other)->recursion_level = max_level; in unix_dgram_sendmsg()
1827 unix_state_unlock(other); in unix_dgram_sendmsg()
1828 other->sk_data_ready(other); in unix_dgram_sendmsg()
1829 sock_put(other); in unix_dgram_sendmsg()
1836 unix_state_unlock(other); in unix_dgram_sendmsg()
1840 if (other) in unix_dgram_sendmsg()
1841 sock_put(other); in unix_dgram_sendmsg()
1855 struct sock *other = NULL; in unix_stream_sendmsg() local
1878 other = unix_peer(sk); in unix_stream_sendmsg()
1879 if (!other) in unix_stream_sendmsg()
1923 unix_state_lock(other); in unix_stream_sendmsg()
1925 if (sock_flag(other, SOCK_DEAD) || in unix_stream_sendmsg()
1926 (other->sk_shutdown & RCV_SHUTDOWN)) in unix_stream_sendmsg()
1929 maybe_add_creds(skb, sock, other); in unix_stream_sendmsg()
1930 skb_queue_tail(&other->sk_receive_queue, skb); in unix_stream_sendmsg()
1931 if (max_level > unix_sk(other)->recursion_level) in unix_stream_sendmsg()
1932 unix_sk(other)->recursion_level = max_level; in unix_stream_sendmsg()
1933 unix_state_unlock(other); in unix_stream_sendmsg()
1934 other->sk_data_ready(other); in unix_stream_sendmsg()
1943 unix_state_unlock(other); in unix_stream_sendmsg()
1961 struct sock *other, *sk = socket->sk; in unix_stream_sendpage() local
1967 other = unix_peer(sk); in unix_stream_sendpage()
1968 if (!other || sk->sk_state != TCP_ESTABLISHED) in unix_stream_sendpage()
1973 unix_state_unlock(other); in unix_stream_sendpage()
1974 mutex_unlock(&unix_sk(other)->readlock); in unix_stream_sendpage()
1984 err = mutex_lock_interruptible(&unix_sk(other)->readlock); in unix_stream_sendpage()
1996 unix_state_lock(other); in unix_stream_sendpage()
1998 if (sock_flag(other, SOCK_DEAD) || in unix_stream_sendpage()
1999 other->sk_shutdown & RCV_SHUTDOWN) { in unix_stream_sendpage()
2006 err = maybe_init_creds(&scm, socket, other); in unix_stream_sendpage()
2012 skb = skb_peek_tail(&other->sk_receive_queue); in unix_stream_sendpage()
2045 spin_lock(&other->sk_receive_queue.lock); in unix_stream_sendpage()
2046 __skb_queue_tail(&other->sk_receive_queue, newskb); in unix_stream_sendpage()
2047 spin_unlock(&other->sk_receive_queue.lock); in unix_stream_sendpage()
2050 unix_state_unlock(other); in unix_stream_sendpage()
2051 mutex_unlock(&unix_sk(other)->readlock); in unix_stream_sendpage()
2053 other->sk_data_ready(other); in unix_stream_sendpage()
2058 unix_state_unlock(other); in unix_stream_sendpage()
2060 mutex_unlock(&unix_sk(other)->readlock); in unix_stream_sendpage()
2534 struct sock *other; in unix_shutdown() local
2547 other = unix_peer(sk); in unix_shutdown()
2548 if (other) in unix_shutdown()
2549 sock_hold(other); in unix_shutdown()
2553 if (other && in unix_shutdown()
2562 unix_state_lock(other); in unix_shutdown()
2563 other->sk_shutdown |= peer_mode; in unix_shutdown()
2564 unix_state_unlock(other); in unix_shutdown()
2565 other->sk_state_change(other); in unix_shutdown()
2567 sk_wake_async(other, SOCK_WAKE_WAITD, POLL_HUP); in unix_shutdown()
2569 sk_wake_async(other, SOCK_WAKE_WAITD, POLL_IN); in unix_shutdown()
2571 if (other) in unix_shutdown()
2572 sock_put(other); in unix_shutdown()
2670 struct sock *sk = sock->sk, *other; in unix_dgram_poll() local
2707 other = unix_peer(sk); in unix_dgram_poll()
2708 if (other && unix_peer(other) != sk && in unix_dgram_poll()
2709 unix_recvq_full(other) && in unix_dgram_poll()
2710 unix_dgram_peer_wake_me(sk, other)) in unix_dgram_poll()