Skip to content

Commit

Permalink
DO-NOT-MERGE: mptcp: improve code coverage for CI
Browse files Browse the repository at this point in the history
mptcp: use kmalloc on kasan build

  Helps detection UaF, which apparently kasan misses with kmem_cache
  allocator.

  We also need to always set the SOCK_RCU_FREE flag, to preserved the
  current code leveraging SLAB_TYPESAFE_BY_RCU. This latter change will
  make unreachable some existing errors path, but I don't see other
  options.

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.

Co-developed-by: Matthieu Baerts <[email protected]>
Signed-off-by: Matthieu Baerts <[email protected]>
Signed-off-by: Paolo Abeni <[email protected]>
  • Loading branch information
Paolo Abeni authored and matttbe committed Jan 15, 2024
1 parent c46c7e3 commit b97dc65
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions net/ipv4/tcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -4484,6 +4484,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 b97dc65

Please sign in to comment.