aboutsummaryrefslogtreecommitdiffstats
path: root/net/unix/af_unix.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/unix/af_unix.c')
-rw-r--r--net/unix/af_unix.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index d510353ef431..eadb9020cd64 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -1442,6 +1442,7 @@ static int unix_dgram_sendmsg(struct kiocb *kiocb, struct socket *sock,
1442 long timeo; 1442 long timeo;
1443 struct scm_cookie tmp_scm; 1443 struct scm_cookie tmp_scm;
1444 int max_level; 1444 int max_level;
1445 int data_len = 0;
1445 1446
1446 if (NULL == siocb->scm) 1447 if (NULL == siocb->scm)
1447 siocb->scm = &tmp_scm; 1448 siocb->scm = &tmp_scm;
@@ -1475,7 +1476,13 @@ static int unix_dgram_sendmsg(struct kiocb *kiocb, struct socket *sock,
1475 if (len > sk->sk_sndbuf - 32) 1476 if (len > sk->sk_sndbuf - 32)
1476 goto out; 1477 goto out;
1477 1478
1478 skb = sock_alloc_send_skb(sk, len, msg->msg_flags&MSG_DONTWAIT, &err); 1479 if (len > SKB_MAX_ALLOC)
1480 data_len = min_t(size_t,
1481 len - SKB_MAX_ALLOC,
1482 MAX_SKB_FRAGS * PAGE_SIZE);
1483
1484 skb = sock_alloc_send_pskb(sk, len - data_len, data_len,
1485 msg->msg_flags & MSG_DONTWAIT, &err);
1479 if (skb == NULL) 1486 if (skb == NULL)
1480 goto out; 1487 goto out;
1481 1488
@@ -1485,8 +1492,10 @@ static int unix_dgram_sendmsg(struct kiocb *kiocb, struct socket *sock,
1485 max_level = err + 1; 1492 max_level = err + 1;
1486 unix_get_secdata(siocb->scm, skb); 1493 unix_get_secdata(siocb->scm, skb);
1487 1494
1488 skb_reset_transport_header(skb); 1495 skb_put(skb, len - data_len);
1489 err = memcpy_fromiovec(skb_put(skb, len), msg->msg_iov, len); 1496 skb->data_len = data_len;
1497 skb->len = len;
1498 err = skb_copy_datagram_from_iovec(skb, 0, msg->msg_iov, 0, len);
1490 if (err) 1499 if (err)
1491 goto out_free; 1500 goto out_free;
1492 1501