diff options
author | Eric Dumazet <edumazet@google.com> | 2016-11-02 14:41:50 -0700 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-11-03 16:12:06 -0400 |
commit | 79d8665b9545e128637c51cf7febde9c493b6481 (patch) | |
tree | 5a25d00198c300afd94f10b59ee5e8c87ee9d0d0 /init | |
parent | 9ee6c5dc816aa8256257f2cd4008a9291ec7e985 (diff) | |
download | linux-79d8665b9545e128637c51cf7febde9c493b6481.tar.bz2 |
tcp: fix return value for partial writes
After my commit, tcp_sendmsg() might restart its loop after
processing socket backlog.
If sk_err is set, we blindly return an error, even though we
copied data to user space before.
We should instead return number of bytes that could be copied,
otherwise user space might resend data and corrupt the stream.
This might happen if another thread is using recvmsg(MSG_ERRQUEUE)
to process timestamps.
Issue was diagnosed by Soheil and Willem, big kudos to them !
Fixes: d41a69f1d390f ("tcp: make tcp_sendmsg() aware of socket backlog")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Willem de Bruijn <willemb@google.com>
Cc: Soheil Hassas Yeganeh <soheil@google.com>
Cc: Yuchung Cheng <ycheng@google.com>
Cc: Neal Cardwell <ncardwell@google.com>
Tested-by: Soheil Hassas Yeganeh <soheil@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'init')
0 files changed, 0 insertions, 0 deletions