Skip to content

Commit

Permalink
af_unix: fix bug on large send()
Browse files Browse the repository at this point in the history
commit e370a72 ("af_unix: improve STREAM behavior with fragmented
memory") added a bug on large send() because the
skb_copy_datagram_from_iovec() call always start from the beginning
of iovec.

We must instead use the @sent variable to properly skip the
already processed part.

Reported-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Eric Dumazet authored and David S. Miller committed Aug 12, 2013
1 parent 6c821bd commit f3dfd20
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion net/unix/af_unix.c
Original file line number Diff line number Diff line change
Expand Up @@ -1669,7 +1669,8 @@ static int unix_stream_sendmsg(struct kiocb *kiocb, struct socket *sock,
skb_put(skb, size - data_len);
skb->data_len = data_len;
skb->len = size;
err = skb_copy_datagram_from_iovec(skb, 0, msg->msg_iov, 0, size);
err = skb_copy_datagram_from_iovec(skb, 0, msg->msg_iov,
sent, size);
if (err) {
kfree_skb(skb);
goto out_err;
Expand Down

0 comments on commit f3dfd20

Please sign in to comment.