From 9ce0596f5c9cdad4e8551cb249e3e90628c54fbd Mon Sep 17 00:00:00 2001 From: JackDoan Date: Wed, 29 Jul 2026 17:12:46 -0500 Subject: [PATCH] tun: don't leak the QueueSet shutdown eventfd when Add fails Both newTunGeneric error branches closed only the tun fd; the Add-failure branch left the freshly created QueueSet (and its shutdown eventfd) orphaned. Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_014ugV2edVqoz3tBvq9J6yWp --- overlay/tun_linux.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/overlay/tun_linux.go b/overlay/tun_linux.go index 386db52f..fbc05a4c 100644 --- a/overlay/tun_linux.go +++ b/overlay/tun_linux.go @@ -242,7 +242,10 @@ func newTunGeneric(c *config.C, l *slog.Logger, fd int, vnetHdr bool, offloadFla } err = qs.Add(fd) if err != nil { + // Add only appends on success, so closing the set here can't + // double-close fd; it releases the set's shutdown eventfd. _ = unix.Close(fd) + _ = qs.Close() return nil, err }