mirror of
https://github.com/slackhq/nebula.git
synced 2026-08-16 03:26:57 +02:00
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 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014ugV2edVqoz3tBvq9J6yWp
This commit is contained in:
@@ -242,7 +242,10 @@ func newTunGeneric(c *config.C, l *slog.Logger, fd int, vnetHdr bool, offloadFla
|
|||||||
}
|
}
|
||||||
err = qs.Add(fd)
|
err = qs.Add(fd)
|
||||||
if err != nil {
|
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)
|
_ = unix.Close(fd)
|
||||||
|
_ = qs.Close()
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user