From 61ae16cb6f57033f8ca0e932ee967e8630d0ecdb Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Thu, 31 Aug 2023 14:08:09 -0700 Subject: [PATCH] ipn/ipnlocal: add missing mutex unlock in error path Found while debugging something else. Updates #cleanup Change-Id: I73fe55da14bcc3b1ffc39e2dbc0d077bc7f70cf1 Signed-off-by: Brad Fitzpatrick --- ipn/ipnlocal/local.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ipn/ipnlocal/local.go b/ipn/ipnlocal/local.go index 61f8bdd7b..d9faf8e00 100644 --- a/ipn/ipnlocal/local.go +++ b/ipn/ipnlocal/local.go @@ -4933,16 +4933,19 @@ func (b *LocalBackend) initTKALocked() error { } // resetForProfileChangeLockedOnEntry resets the backend for a profile change. +// +// b.mu must held on entry. It is released on exit. func (b *LocalBackend) resetForProfileChangeLockedOnEntry() error { b.setNetMapLocked(nil) // Reset netmap. // Reset the NetworkMap in the engine b.e.SetNetworkMap(new(netmap.NetworkMap)) if err := b.initTKALocked(); err != nil { + b.mu.Unlock() return err } b.lastServeConfJSON = mem.B(nil) b.serveConfig = ipn.ServeConfigView{} - b.enterStateLockedOnEntry(ipn.NoState) // Reset state. + b.enterStateLockedOnEntry(ipn.NoState) // Reset state; releases b.mu health.SetLocalLogConfigHealth(nil) return b.Start(ipn.Options{}) }