aboutsummaryrefslogtreecommitdiffstats
path: root/net/unix/af_unix.c
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2009-11-17 19:09:55 -0500
committerDave Airlie <airlied@redhat.com>2009-11-17 19:09:55 -0500
commit46557bef3f3834ac33031c7be27d39d90d507442 (patch)
tree5cfc4a9e1263fe0a15e516ca9695ee2f9b8899e4 /net/unix/af_unix.c
parent4efc50d697ed8d9a91f0005d922907a7b6c9290d (diff)
parentd91d8a3f88059d93e34ac70d059153ec69a9ffc7 (diff)
Merge branch 'drm-core-next' of ../linux-2.6 into drm-next
Diffstat (limited to 'net/unix/af_unix.c')
-rw-r--r--net/unix/af_unix.c7
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);