Skip to content

Commit

Permalink
Squash-to: DO-NOT-MERGE: mptcp: use kmalloc on kasan build
Browse files Browse the repository at this point in the history
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.

This is not really related to the Squash-to patch (mptcp: use kmalloc on
kasan build) but it is just not to create yet another specific commit
for the CI added to both export and export-net branches. This commit can
also be renamed to something like:

  DO-NOT-MERGE: mptcp: improve code coverage for CI

WDYT?

Closes: #362
Link: https://lore.kernel.org/r/20230221-mptcp-warn-tcp-done-close-v1-2-d248242b29b6@tessares.net
Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
  • Loading branch information
matttbe committed Feb 23, 2023
1 parent 72d5522 commit bcffcc8
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions net/ipv4/tcp.c
Expand Up @@ -4639,6 +4639,8 @@ void tcp_done(struct sock *sk)
*/
req = rcu_dereference_protected(tcp_sk(sk)->fastopen_rsk, 1);

WARN_ON_ONCE(sk->sk_state == TCP_CLOSE);

if (sk->sk_state == TCP_SYN_SENT || sk->sk_state == TCP_SYN_RECV)
TCP_INC_STATS(sock_net(sk), TCP_MIB_ATTEMPTFAILS);

Expand Down

0 comments on commit bcffcc8

Please sign in to comment.