@@ -974,6 +974,12 @@ void mptcp_proto_init(void)
static 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,
@@ -989,6 +995,7 @@ int 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 mptcp_sock) +
sizeof(struct ipv6_pinfo);
Otherwise we can leak memory on close, if user space does some setsockopt before connectiong/accepting. Note: the squash tag points to the commit currently introducing mptcp_destroy, but we likely want to move such function in another one - it's currently added as empty Squash-to: "mptcp: Add key generation and token tree" Signed-off-by: Paolo Abeni <pabeni@redhat.com> --- net/mptcp/protocol.c | 7 +++++++ 1 file changed, 7 insertions(+)