diff options
Diffstat (limited to 'net/unix/af_unix.c')
-rw-r--r-- | net/unix/af_unix.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index fc3ebb906911..fc820cd75453 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c | |||
@@ -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); |