Skip to content

Commit f7d56c8

Browse files
author
Herton R. Krzesinski
committed
Merge: sctp: backports from upstream, 2nd phase
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/1878 Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2160516 Tested: lksctp-tools func_tests v1-v2: - add the whole patchset of "inet6: Remove inet6_destroy_sock() calls" instead of only 2 patches of them, as Davide suggested. v2->v3 - drop patch "sctp: delete free member from struct sctp_sched_ops" which is a code improvement, as it may cause stuck. v3->v4: - drop patch "sctp: fix memory leak in sctp_stream_outq_migrate()" which cause another stuck. Signed-off-by: Xin Long <lxin@redhat.com> Approved-by: Davide Caratti <dcaratti@redhat.com> Approved-by: Marcelo Ricardo Leitner <mleitner@redhat.com> Signed-off-by: Herton R. Krzesinski <herton@redhat.com>
2 parents 50b1f6c + ca57aad commit f7d56c8

File tree

15 files changed

+94
-89
lines changed

15 files changed

+94
-89
lines changed

include/net/transp_v6.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,6 @@ ip6_dgram_sock_seq_show(struct seq_file *seq, struct sock *sp, __u16 srcp,
5656

5757
#define LOOPBACK4_IPV6 cpu_to_be32(0x7f000006)
5858

59-
void inet6_destroy_sock(struct sock *sk);
60-
6159
#define IPV6_SEQ_DGRAM_HEADER \
6260
" sl " \
6361
"local_address " \

net/dccp/dccp.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,7 @@ int dccp_rcv_state_process(struct sock *sk, struct sk_buff *skb,
283283
int dccp_rcv_established(struct sock *sk, struct sk_buff *skb,
284284
const struct dccp_hdr *dh, const unsigned int len);
285285

286+
void dccp_destruct_common(struct sock *sk);
286287
int dccp_init_sock(struct sock *sk, const __u8 ctl_sock_initialized);
287288
void dccp_destroy_sock(struct sock *sk);
288289

net/dccp/ipv6.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1003,6 +1003,12 @@ static const struct inet_connection_sock_af_ops dccp_ipv6_mapped = {
10031003
.sockaddr_len = sizeof(struct sockaddr_in6),
10041004
};
10051005

1006+
static void dccp_v6_sk_destruct(struct sock *sk)
1007+
{
1008+
dccp_destruct_common(sk);
1009+
inet6_sock_destruct(sk);
1010+
}
1011+
10061012
/* NOTE: A lot of things set to zero explicitly by call to
10071013
* sk_alloc() so need not be done here.
10081014
*/
@@ -1015,17 +1021,12 @@ static int dccp_v6_init_sock(struct sock *sk)
10151021
if (unlikely(!dccp_v6_ctl_sock_initialized))
10161022
dccp_v6_ctl_sock_initialized = 1;
10171023
inet_csk(sk)->icsk_af_ops = &dccp_ipv6_af_ops;
1024+
sk->sk_destruct = dccp_v6_sk_destruct;
10181025
}
10191026

10201027
return err;
10211028
}
10221029

1023-
static void dccp_v6_destroy_sock(struct sock *sk)
1024-
{
1025-
dccp_destroy_sock(sk);
1026-
inet6_destroy_sock(sk);
1027-
}
1028-
10291030
static struct timewait_sock_ops dccp6_timewait_sock_ops = {
10301031
.twsk_obj_size = sizeof(struct dccp6_timewait_sock),
10311032
};
@@ -1048,7 +1049,7 @@ static struct proto dccp_v6_prot = {
10481049
.accept = inet_csk_accept,
10491050
.get_port = inet_csk_get_port,
10501051
.shutdown = dccp_shutdown,
1051-
.destroy = dccp_v6_destroy_sock,
1052+
.destroy = dccp_destroy_sock,
10521053
.orphan_count = &dccp_orphan_count,
10531054
.max_header = MAX_DCCP_HEADER,
10541055
.obj_size = sizeof(struct dccp6_sock),

net/dccp/proto.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,12 +171,18 @@ const char *dccp_packet_name(const int type)
171171

172172
EXPORT_SYMBOL_GPL(dccp_packet_name);
173173

174-
static void dccp_sk_destruct(struct sock *sk)
174+
void dccp_destruct_common(struct sock *sk)
175175
{
176176
struct dccp_sock *dp = dccp_sk(sk);
177177

178178
ccid_hc_tx_delete(dp->dccps_hc_tx_ccid, sk);
179179
dp->dccps_hc_tx_ccid = NULL;
180+
}
181+
EXPORT_SYMBOL_GPL(dccp_destruct_common);
182+
183+
static void dccp_sk_destruct(struct sock *sk)
184+
{
185+
dccp_destruct_common(sk);
180186
inet_sock_destruct(sk);
181187
}
182188

net/ipv6/af_inet6.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ void inet6_sock_destruct(struct sock *sk)
113113
inet6_cleanup_sock(sk);
114114
inet_sock_destruct(sk);
115115
}
116+
EXPORT_SYMBOL_GPL(inet6_sock_destruct);
116117

117118
static int inet6_create(struct net *net, struct socket *sock, int protocol,
118119
int kern)
@@ -491,7 +492,7 @@ int inet6_release(struct socket *sock)
491492
}
492493
EXPORT_SYMBOL(inet6_release);
493494

494-
void inet6_destroy_sock(struct sock *sk)
495+
void inet6_cleanup_sock(struct sock *sk)
495496
{
496497
struct ipv6_pinfo *np = inet6_sk(sk);
497498
struct sk_buff *skb;
@@ -516,12 +517,6 @@ void inet6_destroy_sock(struct sock *sk)
516517
txopt_put(opt);
517518
}
518519
}
519-
EXPORT_SYMBOL_GPL(inet6_destroy_sock);
520-
521-
void inet6_cleanup_sock(struct sock *sk)
522-
{
523-
inet6_destroy_sock(sk);
524-
}
525520
EXPORT_SYMBOL_GPL(inet6_cleanup_sock);
526521

527522
/*

net/ipv6/ipv6_sockglue.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -989,10 +989,8 @@ static int do_ipv6_setsockopt(struct sock *sk, int level, int optname,
989989
return retv;
990990

991991
e_inval:
992-
release_sock(sk);
993-
if (needs_rtnl)
994-
rtnl_unlock();
995-
return -EINVAL;
992+
retv = -EINVAL;
993+
goto unlock;
996994
}
997995

998996
int ipv6_setsockopt(struct sock *sk, int level, int optname, sockptr_t optval,

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
@@ -1175,8 +1175,6 @@ static void raw6_destroy(struct sock *sk)
11751175
lock_sock(sk);
11761176
ip6_flush_pending_frames(sk);
11771177
release_sock(sk);
1178-
1179-
inet6_destroy_sock(sk);
11801178
}
11811179

11821180
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
/*

0 commit comments

Comments
 (0)