Skip to content

Commit a6df953

Browse files
committed
Merge branch 'mptcp-fixes-for-5-17'
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>
2 parents 8a72710 + 877d11f commit a6df953

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

net/mptcp/protocol.c

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -466,9 +466,12 @@ static bool mptcp_pending_data_fin(struct sock *sk, u64 *seq)
466466
static void mptcp_set_datafin_timeout(const struct sock *sk)
467467
{
468468
struct inet_connection_sock *icsk = inet_csk(sk);
469+
u32 retransmits;
469470

470-
mptcp_sk(sk)->timer_ival = min(TCP_RTO_MAX,
471-
TCP_RTO_MIN << icsk->icsk_retransmits);
471+
retransmits = min_t(u32, icsk->icsk_retransmits,
472+
ilog2(TCP_RTO_MAX / TCP_RTO_MIN));
473+
474+
mptcp_sk(sk)->timer_ival = TCP_RTO_MIN << retransmits;
472475
}
473476

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

32963299
delta = msk->write_seq - v;
3300+
if (__mptcp_check_fallback(msk) && msk->first) {
3301+
struct tcp_sock *tp = tcp_sk(msk->first);
3302+
3303+
/* the first subflow is disconnected after close - see
3304+
* __mptcp_close_ssk(). tcp_disconnect() moves the write_seq
3305+
* so ignore that status, too.
3306+
*/
3307+
if (!((1 << msk->first->sk_state) &
3308+
(TCPF_SYN_SENT | TCPF_SYN_RECV | TCPF_CLOSE)))
3309+
delta += READ_ONCE(tp->write_seq) - tp->snd_una;
3310+
}
32973311
if (delta > INT_MAX)
32983312
delta = INT_MAX;
32993313

tools/testing/selftests/net/mptcp/mptcp_connect.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -763,8 +763,8 @@ run_tests_disconnect()
763763
run_tests_lo "$ns1" "$ns1" dead:beef:1::1 1 "-I 3 -i $old_cin"
764764

765765
# restore previous status
766-
cout=$old_cout
767-
cout_disconnect="$cout".disconnect
766+
sin=$old_sin
767+
sin_disconnect="$cout".disconnect
768768
cin=$old_cin
769769
cin_disconnect="$cin".disconnect
770770
connect_per_transfer=1

0 commit comments

Comments
 (0)