提交 f3dfd208 编写于 作者: E Eric Dumazet 提交者: David S. Miller

af_unix: fix bug on large send()

commit e370a723 ("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: NHannes Frederic Sowa <hannes@stressinduktion.org>
Signed-off-by: NEric Dumazet <edumazet@google.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 6c821bd9
...@@ -1669,7 +1669,8 @@ static int unix_stream_sendmsg(struct kiocb *kiocb, struct socket *sock, ...@@ -1669,7 +1669,8 @@ static int unix_stream_sendmsg(struct kiocb *kiocb, struct socket *sock,
skb_put(skb, size - data_len); skb_put(skb, size - data_len);
skb->data_len = data_len; skb->data_len = data_len;
skb->len = size; 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) { if (err) {
kfree_skb(skb); kfree_skb(skb);
goto out_err; goto out_err;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册