Skip to content

Commit 8555c6b

Browse files
Paolo Abenidavem330
authored andcommitted
mptcp: fix bogus sendmsg() return code under pressure
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 <[email protected]> Signed-off-by: Paolo Abeni <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent f8deaea commit 8555c6b

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

net/mptcp/protocol.c

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

985985
mptcp_set_timeout(sk, ssk);
986986
if (copied) {
987-
ret = copied;
988987
tcp_push(ssk, msg->msg_flags, mss_now, tcp_sk(ssk)->nonagle,
989988
size_goal);
990989

@@ -997,7 +996,7 @@ static int mptcp_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
997996
release_sock(ssk);
998997
out:
999998
release_sock(sk);
1000-
return ret;
999+
return copied ? : ret;
10011000
}
10021001

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

0 commit comments

Comments
 (0)