Skip to content

Commit

Permalink
Merge branch 'mptcp-fixes-for-5-17'
Browse files Browse the repository at this point in the history
Mat Martineau says:

====================
mptcp: Fixes for 5.17

Patch 1 fixes an issue with the SIOCOUTQ ioctl in MPTCP sockets that
have performed a fallback to TCP.

Patch 2 is a selftest fix to correctly remove temp files.

Patch 3 fixes a shift-out-of-bounds issue found by syzkaller.
====================

Link: https://lore.kernel.org/r/20220225005259.318898-1-mathew.j.martineau@linux.intel.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
Jakub Kicinski committed Feb 25, 2022
2 parents 8a72710 + 877d11f commit a6df953
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
18 changes: 16 additions & 2 deletions net/mptcp/protocol.c
Original file line number Diff line number Diff line change
Expand Up @@ -466,9 +466,12 @@ static bool mptcp_pending_data_fin(struct sock *sk, u64 *seq)
static void mptcp_set_datafin_timeout(const struct sock *sk)
{
struct inet_connection_sock *icsk = inet_csk(sk);
u32 retransmits;

mptcp_sk(sk)->timer_ival = min(TCP_RTO_MAX,
TCP_RTO_MIN << icsk->icsk_retransmits);
retransmits = min_t(u32, icsk->icsk_retransmits,
ilog2(TCP_RTO_MAX / TCP_RTO_MIN));

mptcp_sk(sk)->timer_ival = TCP_RTO_MIN << retransmits;
}

static void __mptcp_set_timeout(struct sock *sk, long tout)
Expand Down Expand Up @@ -3294,6 +3297,17 @@ static int mptcp_ioctl_outq(const struct mptcp_sock *msk, u64 v)
return 0;

delta = msk->write_seq - v;
if (__mptcp_check_fallback(msk) && msk->first) {
struct tcp_sock *tp = tcp_sk(msk->first);

/* the first subflow is disconnected after close - see
* __mptcp_close_ssk(). tcp_disconnect() moves the write_seq
* so ignore that status, too.
*/
if (!((1 << msk->first->sk_state) &
(TCPF_SYN_SENT | TCPF_SYN_RECV | TCPF_CLOSE)))
delta += READ_ONCE(tp->write_seq) - tp->snd_una;
}
if (delta > INT_MAX)
delta = INT_MAX;

Expand Down
4 changes: 2 additions & 2 deletions tools/testing/selftests/net/mptcp/mptcp_connect.sh
Original file line number Diff line number Diff line change
Expand Up @@ -763,8 +763,8 @@ run_tests_disconnect()
run_tests_lo "$ns1" "$ns1" dead:beef:1::1 1 "-I 3 -i $old_cin"

# restore previous status
cout=$old_cout
cout_disconnect="$cout".disconnect
sin=$old_sin
sin_disconnect="$cout".disconnect
cin=$old_cin
cin_disconnect="$cin".disconnect
connect_per_transfer=1
Expand Down

0 comments on commit a6df953

Please sign in to comment.