mptcp: fix bogus sendmsg() return code under pressure
authorPaolo Abeni <pabeni@redhat.com>
Mon, 3 Aug 2020 16:40:39 +0000 (18:40 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 11 Aug 2020 13:35:42 +0000 (15:35 +0200)
commitdb74b6228662288b15b3e1a05ab650385beb060d
tree21fe57e094ea8c179e87a4cb31c903aeac881a25
parent81ffffd52fb24439946c9949ec6a71bedc6b9bcb
mptcp: fix bogus sendmsg() return code under pressure

[ Upstream commit 8555c6bfd5fddb1cf363d3cd157d70a1bb27f718 ]

In case of memory pressure, mptcp_sendmsg() may call
sk_stream_wait_memory() after succesfully xmitting some
bytes. If the latter fails we currently return to the
user-space the error code, ignoring the succeful xmit.

Address the issue always checking for the xmitted bytes
before mptcp_sendmsg() completes.

Fixes: f296234c98a8 ("mptcp: Add handling of incoming MP_JOIN requests")
Reviewed-by: Matthieu Baerts <matthieu.baerts@tessares.net>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/mptcp/protocol.c