Skip to content

Commit cfc5c86

Browse files
Paolo Abenimatttbe
authored andcommitted
DO-NOT-MERGE: mptcp: improve code coverage for CI
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 <matthieu.baerts@tessares.net> Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
1 parent 7efea04 commit cfc5c86

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

net/ipv4/tcp.c

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

4527+
WARN_ON_ONCE(sk->sk_state == TCP_CLOSE);
4528+
45274529
if (sk->sk_state == TCP_SYN_SENT || sk->sk_state == TCP_SYN_RECV)
45284530
TCP_INC_STATS(sock_net(sk), TCP_MIB_ATTEMPTFAILS);
45294531

0 commit comments

Comments
 (0)