Skip to content

Commit af4a12d

Browse files
author
Xin Long
committed
inet6: Remove inet6_destroy_sock() in sk->sk_prot->destroy().
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2160516 Tested: compile only Conflicts: - context difference due to missing commit 0ffe241 from upstream. commit b5fc292 Author: Kuniyuki Iwashima <kuniyu@amazon.com> Date: Wed Oct 19 15:35:59 2022 -0700 inet6: Remove inet6_destroy_sock() in sk->sk_prot->destroy(). After commit d38afee ("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 <kuniyu@amazon.com> Reviewed-by: Matthieu Baerts <matthieu.baerts@tessares.net> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Xin Long <lxin@redhat.com>
1 parent ee17c5d commit af4a12d

File tree

6 files changed

+1
-26
lines changed

6 files changed

+1
-26
lines changed

net/ipv6/ping.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,6 @@
2222
#include <linux/proc_fs.h>
2323
#include <net/ping.h>
2424

25-
static void ping_v6_destroy(struct sock *sk)
26-
{
27-
inet6_destroy_sock(sk);
28-
}
29-
3025
/* Compatibility glue so we can support IPv6 when it's compiled as a module */
3126
static int dummy_ipv6_recv_error(struct sock *sk, struct msghdr *msg, int len,
3227
int *addr_len)
@@ -171,7 +166,6 @@ struct proto pingv6_prot = {
171166
.owner = THIS_MODULE,
172167
.init = ping_init_sock,
173168
.close = ping_close,
174-
.destroy = ping_v6_destroy,
175169
.connect = ip6_datagram_connect_v6_only,
176170
.disconnect = __udp_disconnect,
177171
.setsockopt = ipv6_setsockopt,

net/ipv6/raw.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1171,8 +1171,6 @@ static void raw6_destroy(struct sock *sk)
11711171
lock_sock(sk);
11721172
ip6_flush_pending_frames(sk);
11731173
release_sock(sk);
1174-
1175-
inet6_destroy_sock(sk);
11761174
}
11771175

11781176
static int rawv6_init_sk(struct sock *sk)

net/ipv6/tcp_ipv6.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1936,12 +1936,6 @@ static int tcp_v6_init_sock(struct sock *sk)
19361936
return 0;
19371937
}
19381938

1939-
static void tcp_v6_destroy_sock(struct sock *sk)
1940-
{
1941-
tcp_v4_destroy_sock(sk);
1942-
inet6_destroy_sock(sk);
1943-
}
1944-
19451939
#ifdef CONFIG_PROC_FS
19461940
/* Proc filesystem TCPv6 sock list dumping. */
19471941
static void get_openreq6(struct seq_file *seq,
@@ -2134,7 +2128,7 @@ struct proto tcpv6_prot = {
21342128
.accept = inet_csk_accept,
21352129
.ioctl = tcp_ioctl,
21362130
.init = tcp_v6_init_sock,
2137-
.destroy = tcp_v6_destroy_sock,
2131+
.destroy = tcp_v4_destroy_sock,
21382132
.shutdown = tcp_shutdown,
21392133
.setsockopt = tcp_setsockopt,
21402134
.getsockopt = tcp_getsockopt,

net/ipv6/udp.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1662,8 +1662,6 @@ void udpv6_destroy_sock(struct sock *sk)
16621662
udp_encap_disable();
16631663
}
16641664
}
1665-
1666-
inet6_destroy_sock(sk);
16671665
}
16681666

16691667
/*

net/l2tp/l2tp_ip6.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,8 +257,6 @@ static void l2tp_ip6_destroy_sock(struct sock *sk)
257257

258258
if (tunnel)
259259
l2tp_tunnel_delete(tunnel);
260-
261-
inet6_destroy_sock(sk);
262260
}
263261

264262
static int l2tp_ip6_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len)

net/mptcp/protocol.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3925,12 +3925,6 @@ static const struct proto_ops mptcp_v6_stream_ops = {
39253925

39263926
static struct proto mptcp_v6_prot;
39273927

3928-
static void mptcp_v6_destroy(struct sock *sk)
3929-
{
3930-
mptcp_destroy(sk);
3931-
inet6_destroy_sock(sk);
3932-
}
3933-
39343928
static struct inet_protosw mptcp_v6_protosw = {
39353929
.type = SOCK_STREAM,
39363930
.protocol = IPPROTO_MPTCP,
@@ -3946,7 +3940,6 @@ int __init mptcp_proto_v6_init(void)
39463940
mptcp_v6_prot = mptcp_prot;
39473941
strcpy(mptcp_v6_prot.name, "MPTCPv6");
39483942
mptcp_v6_prot.slab = NULL;
3949-
mptcp_v6_prot.destroy = mptcp_v6_destroy;
39503943
mptcp_v6_prot.obj_size = sizeof(struct mptcp6_sock);
39513944

39523945
err = proto_register(&mptcp_v6_prot, 1);

0 commit comments

Comments
 (0)