Re: [PATCH net v3 2/2] sctp: close UDP tunnel sockets during netns teardown
Xin Long <[email protected]> Thu, 16 Jul 2026 09:31:49 -0400
| Newsgroups | org.kernel.vger.linux-sctp,org.kernel.vger.netdev |
|---|---|
| Message-ID | <CADvbK_c7ZimrdY=yf+7jGzLTN6ZOT+-4_LzQxAg9-fEostzDtQ@mail.gmail.com> |
On Tue, Jul 14, 2026 at 9:51=E2=80=AFPM Ren Wei <[email protected]> wrote: > > From: Zhiling Zou <[email protected]> > > proc_sctp_do_udp_port() starts per-net SCTP UDP tunneling sockets when > net.sctp.udp_port is set, and stops/restarts them when the sysctl value > changes. The netns exit path does not stop these sockets, so a namespace > can be torn down while its SCTP UDP tunnel sockets are still installed. > > Close the UDP tunnel sockets from sctp_ctrlsock_exit() after unregisterin= g > the per-net sysctl table. This prevents new sysctl writes from racing in > while the sockets are being released, and closes the sockets before the > control socket is destroyed. > > Fixes: 046c052b475e ("sctp: enable udp tunneling socks") > Cc: [email protected] > Reported-by: Sashiko <[email protected]> > Closes: https://sashiko.dev/#/patchset/b9f1f02b0780ad6a719e2413f5f0bb8eb7= 702d94.1782585631.git.roxy520tt%40gmail.com > Signed-off-by: Zhiling Zou <[email protected]> > Signed-off-by: Ren Wei <[email protected]> > --- > Changes in v3: > - No code changes. > > net/sctp/protocol.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c > index 49d9740b1e0f..27c26e12f95d 100644 > --- a/net/sctp/protocol.c > +++ b/net/sctp/protocol.c > @@ -1460,6 +1460,7 @@ static int __net_init sctp_ctrlsock_init(struct net= *net) > static void __net_exit sctp_ctrlsock_exit(struct net *net) > { > sctp_sysctl_net_unregister(net); > + sctp_udp_sock_stop(net); > > /* Free the control endpoint. */ > inet_ctl_sock_destroy(net->sctp.ctl_sock); > -- > 2.43.0 > Acked-by: Xin Long <[email protected]>