From 99722d06ad908a7d32f654323b51030a331990d5 Mon Sep 17 00:00:00 2001 From: Ethan Date: Fri, 13 Nov 2026 10:54:43 -0800 Subject: [PATCH] tsi: release the control socket and addresses in tsi_release tsi_create_common() and tsi_accept() give every TSI socket its own control socket (tsk->csocket, an AF_VSOCK datagram socket), and bind() and sendto() may allocate tsk->bound_addr and tsk->sendto_addr, but tsi_release() frees none of them. Every socket() and every accepted connection in the guest therefore leaves a kernel vsock socket (a sockfs inode and its slab) behind until the VM stops. The leaked sockets have no file descriptor, so they never show up in /proc//fd and drop_caches cannot reclaim them: only inode-nr and SUnreclaim keep growing. A long-running guest doing ordinary work leaked 4,000 to 9,000 of them an hour; after 25 hours, 166,000 leaked inodes and 288 MB of SUnreclaim (about 47 MB on a fresh boot). Release them in tsi_release(), as the TSIv4 rewrite already does. Signed-off-by: Ethan --- net/tsi/af_tsi.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/net/tsi/af_tsi.c b/net/tsi/af_tsi.c index 231ce56dd2dfec..87131d65ef9949 100644 --- a/net/tsi/af_tsi.c +++ b/net/tsi/af_tsi.c @@ -180,6 +180,15 @@ static int tsi_release(struct socket *sock) sock_release(isocket); } + if (tsk->csocket) { + sock_release(tsk->csocket); + tsk->csocket = NULL; + } + kfree(tsk->bound_addr); + tsk->bound_addr = NULL; + kfree(tsk->sendto_addr); + tsk->sendto_addr = NULL; + sock_orphan(sk); sk->sk_shutdown = SHUTDOWN_MASK; skb_queue_purge(&sk->sk_receive_queue);