Skip to content

Commit db74b62

Browse files
Paolo Abenigregkh
authored andcommitted
mptcp: fix bogus sendmsg() return code under pressure
[ Upstream commit 8555c6b ] 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: f296234 ("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>
1 parent 81ffffd commit db74b62

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

‎net/mptcp/protocol.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -802,7 +802,6 @@ static int mptcp_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
802802

803803
mptcp_set_timeout(sk, ssk);
804804
if (copied) {
805-
ret = copied;
806805
tcp_push(ssk, msg->msg_flags, mss_now, tcp_sk(ssk)->nonagle,
807806
size_goal);
808807

@@ -815,7 +814,7 @@ static int mptcp_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
815814
release_sock(ssk);
816815
out:
817816
release_sock(sk);
818-
return ret;
817+
return copied ? : ret;
819818
}
820819

821820
static void mptcp_wait_data(struct sock *sk, long *timeo)

0 commit comments

Comments
 (0)