diff options
Diffstat (limited to 'net/unix/af_unix.c')
| -rw-r--r-- | net/unix/af_unix.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index 36d4e44d623..fc820cd7545 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c | |||
| @@ -315,7 +315,7 @@ static void unix_write_space(struct sock *sk) | |||
| 315 | { | 315 | { |
| 316 | read_lock(&sk->sk_callback_lock); | 316 | read_lock(&sk->sk_callback_lock); |
| 317 | if (unix_writable(sk)) { | 317 | if (unix_writable(sk)) { |
| 318 | if (sk->sk_sleep && waitqueue_active(sk->sk_sleep)) | 318 | if (sk_has_sleeper(sk)) |
| 319 | wake_up_interruptible_sync(sk->sk_sleep); | 319 | wake_up_interruptible_sync(sk->sk_sleep); |
| 320 | sk_wake_async(sk, SOCK_WAKE_SPACE, POLL_OUT); | 320 | sk_wake_async(sk, SOCK_WAKE_SPACE, POLL_OUT); |
| 321 | } | 321 | } |
| @@ -1074,6 +1074,8 @@ restart: | |||
| 1074 | err = -ECONNREFUSED; | 1074 | err = -ECONNREFUSED; |
| 1075 | if (other->sk_state != TCP_LISTEN) | 1075 | if (other->sk_state != TCP_LISTEN) |
| 1076 | goto out_unlock; | 1076 | goto out_unlock; |
| 1077 | if (other->sk_shutdown & RCV_SHUTDOWN) | ||
| 1078 | goto out_unlock; | ||
| 1077 | 1079 | ||
| 1078 | if (unix_recvq_full(other)) { | 1080 | if (unix_recvq_full(other)) { |
| 1079 | err = -EAGAIN; | 1081 | err = -EAGAIN; |
| @@ -1501,6 +1503,7 @@ static int unix_stream_sendmsg(struct kiocb *kiocb, struct socket *sock, | |||
| 1501 | struct sk_buff *skb; | 1503 | struct sk_buff *skb; |
| 1502 | int sent = 0; | 1504 | int sent = 0; |
| 1503 | struct scm_cookie tmp_scm; | 1505 | struct scm_cookie tmp_scm; |
| 1506 | bool fds_sent = false; | ||
| 1504 | 1507 | ||
| 1505 | if (NULL == siocb->scm) | 1508 | if (NULL == siocb->scm) |
| 1506 | siocb->scm = &tmp_scm; | 1509 | siocb->scm = &tmp_scm; |
| @@ -1562,12 +1565,14 @@ static int unix_stream_sendmsg(struct kiocb *kiocb, struct socket *sock, | |||
| 1562 | size = min_t(int, size, skb_tailroom(skb)); | 1565 | size = min_t(int, size, skb_tailroom(skb)); |
| 1563 | 1566 | ||
| 1564 | memcpy(UNIXCREDS(skb), &siocb->scm->creds, sizeof(struct ucred)); | 1567 | memcpy(UNIXCREDS(skb), &siocb->scm->creds, sizeof(struct ucred)); |
| 1565 | if (siocb->scm->fp) { | 1568 | /* Only send the fds in the first buffer */ |
| 1569 | if (siocb->scm->fp && !fds_sent) { | ||
| 1566 | err = unix_attach_fds(siocb->scm, skb); | 1570 | err = unix_attach_fds(siocb->scm, skb); |
| 1567 | if (err) { | 1571 | if (err) { |
| 1568 | kfree_skb(skb); | 1572 | kfree_skb(skb); |
| 1569 | goto out_err; | 1573 | goto out_err; |
| 1570 | } | 1574 | } |
| 1575 | fds_sent = true; | ||
| 1571 | } | 1576 | } |
| 1572 | 1577 | ||
| 1573 | err = memcpy_fromiovec(skb_put(skb, size), msg->msg_iov, size); | 1578 | err = memcpy_fromiovec(skb_put(skb, size), msg->msg_iov, size); |
| @@ -1985,7 +1990,7 @@ static unsigned int unix_poll(struct file *file, struct socket *sock, poll_table | |||
| 1985 | struct sock *sk = sock->sk; | 1990 | struct sock *sk = sock->sk; |
| 1986 | unsigned int mask; | 1991 | unsigned int mask; |
| 1987 | 1992 | ||
| 1988 | poll_wait(file, sk->sk_sleep, wait); | 1993 | sock_poll_wait(file, sk->sk_sleep, wait); |
| 1989 | mask = 0; | 1994 | mask = 0; |
| 1990 | 1995 | ||
| 1991 | /* exceptional events? */ | 1996 | /* exceptional events? */ |
| @@ -2022,7 +2027,7 @@ static unsigned int unix_dgram_poll(struct file *file, struct socket *sock, | |||
| 2022 | struct sock *sk = sock->sk, *other; | 2027 | struct sock *sk = sock->sk, *other; |
| 2023 | unsigned int mask, writable; | 2028 | unsigned int mask, writable; |
| 2024 | 2029 | ||
| 2025 | poll_wait(file, sk->sk_sleep, wait); | 2030 | sock_poll_wait(file, sk->sk_sleep, wait); |
| 2026 | mask = 0; | 2031 | mask = 0; |
| 2027 | 2032 | ||
| 2028 | /* exceptional events? */ | 2033 | /* exceptional events? */ |
| @@ -2053,7 +2058,7 @@ static unsigned int unix_dgram_poll(struct file *file, struct socket *sock, | |||
| 2053 | other = unix_peer_get(sk); | 2058 | other = unix_peer_get(sk); |
| 2054 | if (other) { | 2059 | if (other) { |
| 2055 | if (unix_peer(other) != sk) { | 2060 | if (unix_peer(other) != sk) { |
| 2056 | poll_wait(file, &unix_sk(other)->peer_wait, | 2061 | sock_poll_wait(file, &unix_sk(other)->peer_wait, |
| 2057 | wait); | 2062 | wait); |
| 2058 | if (unix_recvq_full(other)) | 2063 | if (unix_recvq_full(other)) |
| 2059 | writable = 0; | 2064 | writable = 0; |
