[PATCH mptcp-net 2/2] Squash-to: DO-NOT-MERGE: mptcp: use kmalloc on kasan build

Matthieu Baerts posted 2 patches 2 years, 10 months ago
Maintainers: Eric Dumazet <edumazet@google.com>, "David S. Miller" <davem@davemloft.net>, David Ahern <dsahern@kernel.org>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, Matthieu Baerts <matthieu.baerts@tessares.net>, Mat Martineau <mathew.j.martineau@linux.intel.com>
[PATCH mptcp-net 2/2] Squash-to: DO-NOT-MERGE: mptcp: use kmalloc on kasan build
Posted by Matthieu Baerts 2 years, 10 months ago
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: https://github.com/multipath-tcp/mptcp_net-next/issues/362
Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
---
 net/ipv4/tcp.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 33f559f491c8..d21ec9bdd453 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -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);
 

-- 
2.38.1