Skip to content

Commit

Permalink
mptcp: avoid data corruption on reinsert
Browse files Browse the repository at this point in the history
When updating a partially acked data fragment, we
actually corrupt it. This is irrelevant till we send
data on a single subflow, as retransmitted data, if
any are discarded by the peer as duplicate, but it
will cause data corruption as soon as we will start
creating non backup subflows.

Reviewed-by: Mat Martineau <[email protected]>
Tested-by: Christoph Paasch <[email protected]>
Signed-off-by: Paolo Abeni <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Paolo Abeni authored and davem330 committed Jul 23, 2020
1 parent b0977bb commit 53eb4c3
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion net/mptcp/protocol.c
Original file line number Diff line number Diff line change
Expand Up @@ -460,15 +460,20 @@ static void mptcp_clean_una(struct sock *sk)

dfrag = mptcp_rtx_head(sk);
if (dfrag && after64(snd_una, dfrag->data_seq)) {
u64 delta = dfrag->data_seq + dfrag->data_len - snd_una;
u64 delta = snd_una - dfrag->data_seq;

if (WARN_ON_ONCE(delta > dfrag->data_len))
goto out;

dfrag->data_seq += delta;
dfrag->offset += delta;
dfrag->data_len -= delta;

dfrag_uncharge(sk, delta);
cleaned = true;
}

out:
if (cleaned) {
sk_mem_reclaim_partial(sk);

Expand Down

0 comments on commit 53eb4c3

Please sign in to comment.