Skip to content

Commit fff6352

Browse files
committed
Merge branch 'mptcp-fixes'
Mat Martineau says: ==================== mptcp: Fixes for buffer reclaim and option writing Here are three fixes dealing with a syzkaller crash MPTCP triggers in the memory manager in 5.16-rc8, and some option writing problems. Patches 1 and 2 fix some corner cases in MPTCP option writing. Patch 3 addresses a crash that syzkaller found a way to trigger in the mm subsystem by passing an invalid value to __sk_mem_reduce_allocated(). ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents 14676c0 + 269bda9 commit fff6352

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

net/mptcp/options.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -821,10 +821,13 @@ bool mptcp_established_options(struct sock *sk, struct sk_buff *skb,
821821
if (mptcp_established_options_mp(sk, skb, snd_data_fin, &opt_size, remaining, opts))
822822
ret = true;
823823
else if (mptcp_established_options_dss(sk, skb, snd_data_fin, &opt_size, remaining, opts)) {
824+
unsigned int mp_fail_size;
825+
824826
ret = true;
825-
if (mptcp_established_options_mp_fail(sk, &opt_size, remaining, opts)) {
826-
*size += opt_size;
827-
remaining -= opt_size;
827+
if (mptcp_established_options_mp_fail(sk, &mp_fail_size,
828+
remaining - opt_size, opts)) {
829+
*size += opt_size + mp_fail_size;
830+
remaining -= opt_size - mp_fail_size;
828831
return true;
829832
}
830833
}
@@ -1316,6 +1319,7 @@ void mptcp_write_options(__be32 *ptr, const struct tcp_sock *tp,
13161319
put_unaligned_be32(mpext->data_len << 16 |
13171320
TCPOPT_NOP << 8 | TCPOPT_NOP, ptr);
13181321
}
1322+
ptr += 1;
13191323
}
13201324
} else if (OPTIONS_MPTCP_MPC & opts->suboptions) {
13211325
u8 len, flag = MPTCP_CAP_HMAC_SHA256;

net/mptcp/protocol.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -972,7 +972,9 @@ static void __mptcp_mem_reclaim_partial(struct sock *sk)
972972

973973
lockdep_assert_held_once(&sk->sk_lock.slock);
974974

975-
__mptcp_rmem_reclaim(sk, reclaimable - 1);
975+
if (reclaimable > SK_MEM_QUANTUM)
976+
__mptcp_rmem_reclaim(sk, reclaimable - 1);
977+
976978
sk_mem_reclaim_partial(sk);
977979
}
978980

0 commit comments

Comments
 (0)