Thread (9 messages) 9 messages, 3 authors, 2022-10-19

Re: [PATCH v1 net-next 1/5] inet6: Remove inet6_destroy_sock() in sk->sk_prot->destroy().

From: Kuniyuki Iwashima <hidden>
Date: 2022-10-19 15:39:56
Also in: mptcp

From:   Matthieu Baerts <redacted>
Date:   Wed, 19 Oct 2022 15:22:40 +0200
Hi Kuniyuki,

+cc MPTCP ML.

On 18/10/2022 21:09, Kuniyuki Iwashima wrote:
quoted
After commit d38afeec26ed ("tcp/udp: Call inet6_destroy_sock()
in IPv6 sk->sk_destruct()."), we call inet6_destroy_sock() in
sk->sk_destruct() by setting inet6_sock_destruct() to it to make
sure we do not leak inet6-specific resources.

Now we can remove unnecessary inet6_destroy_sock() calls in
sk->sk_prot->destroy().

DCCP and SCTP have their own sk->sk_destruct() function, so we
change them separately in the following patches.

Signed-off-by: Kuniyuki Iwashima <redacted>
---
Cc: Mat Martineau <redacted>
Cc: Matthieu Baerts <redacted>
Thank you for the cc!
Please next time also cc MPTCP ML if you don't mind.
Sure!

(...)
quoted
diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index f599ad44ed24..7cc9c542c768 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -17,9 +17,6 @@
 #include <net/protocol.h>
 #include <net/tcp.h>
 #include <net/tcp_states.h>
-#if IS_ENABLED(CONFIG_MPTCP_IPV6)
-#include <net/transp_v6.h>
-#endif
Please keep this include: it is needed to access "tcpv6_prot" (as
reported by the kernel bot).
Will add it back in v2.

I wonder why allmodconfig couldn't catch this and noticed MPTCP
cannot be modulised.
I'll test all(yes|mod|no)config from next time :)

quoted
 #include <net/mptcp.h>
 #include <net/xfrm.h>
 #include <asm/ioctls.h>
@@ -3898,12 +3895,6 @@ static const struct proto_ops mptcp_v6_stream_ops = {
 
 static struct proto mptcp_v6_prot;
 
-static void mptcp_v6_destroy(struct sock *sk)
-{
-	mptcp_destroy(sk);
-	inet6_destroy_sock(sk);
-}
-
 static struct inet_protosw mptcp_v6_protosw = {
 	.type		= SOCK_STREAM,
 	.protocol	= IPPROTO_MPTCP,
@@ -3919,7 +3910,6 @@ int __init mptcp_proto_v6_init(void)
 	mptcp_v6_prot = mptcp_prot;
 	strcpy(mptcp_v6_prot.name, "MPTCPv6");
 	mptcp_v6_prot.slab = NULL;
-	mptcp_v6_prot.destroy = mptcp_v6_destroy;
 	mptcp_v6_prot.obj_size = sizeof(struct mptcp6_sock);
 
 	err = proto_register(&mptcp_v6_prot, 1);
I see that for MPTCP IPv6 sockets, sk->sk_destruct is now set to
inet6_sock_destruct() which calls inet6_destroy_sock() via
inet6_cleanup_sock().

So all good for the MPTCP part (if you re-add the include ;) ).
Thank you!

Cheers,
Matt
-- 
Tessares | Belgium | Hybrid Access Solutions
www.tessares.net
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help