Skip to content

Commit

Permalink
mptcp: make sure timer is inited/started once data is pending for tra…
Browse files Browse the repository at this point in the history
…nsmission

The mptcp_connect self-tests with additional '-m mmap' argument triggers a
(harmless) WARN_ON_ONCE splat in mptcp_reset_timer() as the mptcp timer
is not initialized yet.

This is because the timer is only set up after the transmit loop, but
consecutive iterations can trigger the splat.

Make sure the timer is set as soon as we pass the first chunk of data.

Closes: #3
Signed-off-by: Florian Westphal <fw@strlen.de>
  • Loading branch information
Florian Westphal authored and jenkins-tessares committed May 10, 2020
1 parent 3fa0363 commit cb06c84
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions net/mptcp/protocol.c
Original file line number Diff line number Diff line change
Expand Up @@ -785,6 +785,11 @@ static int mptcp_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
}

copied += ret;
mptcp_set_timeout(sk, ssk);
/* start the timer, if it's not pending */
if (!mptcp_timer_pending(sk))
mptcp_reset_timer(sk);

tx_ok = msg_data_left(msg);
if (!tx_ok)
break;
Expand All @@ -796,12 +801,10 @@ static int mptcp_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
}
}

mptcp_set_timeout(sk, ssk);
if (copied) {
ret = copied;
tcp_push(ssk, msg->msg_flags, mss_now, tcp_sk(ssk)->nonagle,
size_goal);

/* start the timer, if it's not pending */
if (!mptcp_timer_pending(sk))
mptcp_reset_timer(sk);
Expand Down

0 comments on commit cb06c84

Please sign in to comment.