mptcp: do not shrink snd_nxt when recovering
authorFlorian Westphal <fw@strlen.de>
Fri, 24 Sep 2021 21:12:34 +0000 (14:12 -0700)
committerDavid S. Miller <davem@davemloft.net>
Sat, 25 Sep 2021 10:36:51 +0000 (11:36 +0100)
commit0d199e4363b482badcedba764e2aceab53a4a10a
tree3faad2f883c63092c4f59dc262e56acfb6c5bf3e
parent8765de69e7a18d7d17b9c367ae9ca653bc50e8b0
mptcp: do not shrink snd_nxt when recovering

When recovering after a link failure, snd_nxt should not be set to a
lower value.  Else, update of snd_nxt is broken because:

  msk->snd_nxt += ret; (where ret is number of bytes sent)

assumes that snd_nxt always moves forward.
After reduction, its possible that snd_nxt update gets out of sync:
dfrag we just sent might have had a data sequence number even past
recovery_snd_nxt.

This change factors the common msk state update to a helper
and updates snd_nxt based on the current dfrag data sequence number.

The conditional is required for the recovery phase where we may
re-transmit old dfrags that are before current snd_nxt.

After this change, snd_nxt only moves forward and covers all in-sequence
data that was transmitted.

recovery_snd_nxt is retained to detect when recovery has completed.

Fixes: 1e1d9d6f119c5 ("mptcp: handle pending data on closed subflow")
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/mptcp/options.c
net/mptcp/protocol.c