Skip to content

Commit

Permalink
mptcp: fix 32 bit DSN expansion
Browse files Browse the repository at this point in the history
The current implementation of 32 bit DSN expansion is buggy.
After the previous patch, we can simply reuse the newly
introduced helper to do the expansion safely.

Closes: #120
Fixes: 648ef4b ("mptcp: Implement MPTCP receive path")
Reviewed-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
  • Loading branch information
Paolo Abeni authored and jenkins-tessares committed Jun 22, 2021
1 parent 7b58f13 commit 19a845a
Showing 1 changed file with 1 addition and 16 deletions.
17 changes: 1 addition & 16 deletions net/mptcp/subflow.c
Original file line number Diff line number Diff line change
Expand Up @@ -778,15 +778,6 @@ enum mapping_status {
MAPPING_DUMMY
};

static u64 expand_seq(u64 old_seq, u16 old_data_len, u64 seq)
{
if ((u32)seq == (u32)old_seq)
return old_seq;

/* Assume map covers data not mapped yet. */
return seq | ((old_seq + old_data_len + 1) & GENMASK_ULL(63, 32));
}

static void dbg_bad_map(struct mptcp_subflow_context *subflow, u32 ssn)
{
pr_debug("Bad mapping: ssn=%d map_seq=%d map_data_len=%d",
Expand Down Expand Up @@ -992,13 +983,7 @@ static enum mapping_status get_mapping_status(struct sock *ssk,
data_len--;
}

if (!mpext->dsn64) {
map_seq = expand_seq(subflow->map_seq, subflow->map_data_len,
mpext->data_seq);
pr_debug("expanded seq=%llu", subflow->map_seq);
} else {
map_seq = mpext->data_seq;
}
map_seq = mptcp_expand_seq(READ_ONCE(msk->ack_seq), mpext->data_seq, mpext->dsn64);
WRITE_ONCE(mptcp_sk(subflow->conn)->use_64bit_ack, !!mpext->dsn64);

if (subflow->map_valid) {
Expand Down

0 comments on commit 19a845a

Please sign in to comment.