From 1ddc334969d6a037c566f7e4c257b77a9161f82f Mon Sep 17 00:00:00 2001 From: Christoph Paasch Date: Wed, 5 Aug 2020 13:34:23 -0700 Subject: [PATCH] mptcp: Use correct MSS for space-computation We have seen the following WARN: [ 413.544376] ------------[ cut here ]------------ [ 413.566704] in_flight 0 cwnd 1 wseq 509214375 snxt 509212959 mss_now 1416 cache 1424 [...] [ 414.485683] Call Trace: [ 414.497589] mptcp_write_xmit+0xc3/0x490 [ 414.516761] __tcp_push_pending_frames+0x38/0xd0 [ 414.539402] tcp_sendmsg_locked+0x8f8/0xd00 [ 414.559813] tcp_sendmsg+0x27/0x40 [ 414.576339] sock_sendmsg+0x36/0x50 [ 414.593346] sock_write_iter+0x8f/0x100 [ 414.612081] __vfs_write+0x112/0x1a0 [ 414.629447] vfs_write+0xad/0x1a0 [ 414.645486] ksys_write+0x5a/0xd0 [ 414.661601] do_syscall_64+0x5b/0x1b0 [ 414.679146] entry_SYSCALL_64_after_hwframe+0x44/0xa9 mss_now can effectively be different from mss_cache, if for example we need to combine SACK with data. In that case, mptcp_is_temp_unavailable will make the wrong decision. We should get the correct mss from tcp_current_mss right away. Fixes: 988ec1373bec ("mptcp: Make sure that we don't overfill subflows") Signed-off-by: Christoph Paasch Signed-off-by: Matthieu Baerts (cherry picked from commit 9d3f35bb152a0f04d6833ac739ce505ec2d8d627) Signed-off-by: Matthieu Baerts (cherry picked from commit 2ec4990badaff828793a19aaea463080b493c18b) Signed-off-by: Matthieu Baerts --- net/mptcp/mptcp_sched.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/net/mptcp/mptcp_sched.c b/net/mptcp/mptcp_sched.c index 0ab118acb641c..94244720c280a 100644 --- a/net/mptcp/mptcp_sched.c +++ b/net/mptcp/mptcp_sched.c @@ -70,10 +70,12 @@ static bool mptcp_is_temp_unavailable(struct sock *sk, if (in_flight >= tp->snd_cwnd) return true; + mss_now = tcp_current_mss(sk); + /* Now, check if what is queued in the subflow's send-queue * already fills the cwnd. */ - space = (tp->snd_cwnd - in_flight) * tp->mss_cache; + space = (tp->snd_cwnd - in_flight) * mss_now; if (tp->write_seq - tp->snd_nxt >= space) return true; @@ -81,8 +83,6 @@ static bool mptcp_is_temp_unavailable(struct sock *sk, if (zero_wnd_test && !before(tp->write_seq, tcp_wnd_end(tp))) return true; - mss_now = tcp_current_mss(sk); - /* Don't send on this subflow if we bypass the allowed send-window at * the per-subflow level. Similar to tcp_snd_wnd_test, but manually * calculated end_seq (because here at this point end_seq is still at