Skip to content

Commit a22f801

Browse files
committed
DO-NOT-MERGE: mptcp: improve code coverage for CI
tcp: warn if tcp_done() is called on a closed socket This is an extra check mainly for the CIs: to make sure we don't call tcp_done() on an already closed socket as it happened in the past. If we do such call, better to catch the error earlier. mptcp: warn in case of bogus mpc option on established client sk As discussed on [1], an additional check is done to catch local software bug. This patch is supposed to land only in our tree, for both 'export' and 'export-net' branches, because the warning could be triggered by bugged / malicious peer. We want it in our tree for our CI to detect internal bugs. Link: https://lore.kernel.org/all/[email protected]/ [1] Signed-off-by: Matthieu Baerts <[email protected]>
1 parent fddb1c9 commit a22f801

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

net/ipv4/tcp.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4596,6 +4596,8 @@ void tcp_done(struct sock *sk)
45964596
*/
45974597
req = rcu_dereference_protected(tcp_sk(sk)->fastopen_rsk, 1);
45984598

4599+
WARN_ON_ONCE(sk->sk_state == TCP_CLOSE);
4600+
45994601
if (sk->sk_state == TCP_SYN_SENT || sk->sk_state == TCP_SYN_RECV)
46004602
TCP_INC_STATS(sock_net(sk), TCP_MIB_ATTEMPTFAILS);
46014603

net/mptcp/options.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -983,7 +983,8 @@ static bool check_fully_established(struct mptcp_sock *msk, struct sock *ssk,
983983
WRITE_ONCE(msk->pm.remote_deny_join_id0, true);
984984

985985
if (unlikely(!READ_ONCE(msk->pm.server_side)))
986-
pr_warn_once("bogus mpc option on established client sk");
986+
/* DO-NOT-MERGE: use WARN i/o pr_warn: only for MPTCP export */
987+
WARN_ONCE(1, "bogus mpc option on established client sk");
987988

988989
set_fully_established:
989990
mptcp_data_lock((struct sock *)msk);

0 commit comments

Comments
 (0)