Commit a6df953f authored by Jakub Kicinski's avatar Jakub Kicinski
Browse files

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: default avatarJakub Kicinski <kuba@kernel.org>
parents 8a727100 877d11f0
Loading
Loading
Loading
Loading
+16 −2
Original line number Diff line number Diff line
@@ -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)
@@ -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;

+2 −2
Original line number Diff line number Diff line
@@ -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