ipn/ipnlocal: add missing mutex unlock in error path

Found while debugging something else.

Updates #cleanup

Change-Id: I73fe55da14bcc3b1ffc39e2dbc0d077bc7f70cf1
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
pull/9190/head
Brad Fitzpatrick 1 year ago committed by Brad Fitzpatrick
parent 47cf836720
commit 61ae16cb6f

@ -4933,16 +4933,19 @@ func (b *LocalBackend) initTKALocked() error {
} }
// resetForProfileChangeLockedOnEntry resets the backend for a profile change. // resetForProfileChangeLockedOnEntry resets the backend for a profile change.
//
// b.mu must held on entry. It is released on exit.
func (b *LocalBackend) resetForProfileChangeLockedOnEntry() error { func (b *LocalBackend) resetForProfileChangeLockedOnEntry() error {
b.setNetMapLocked(nil) // Reset netmap. b.setNetMapLocked(nil) // Reset netmap.
// Reset the NetworkMap in the engine // Reset the NetworkMap in the engine
b.e.SetNetworkMap(new(netmap.NetworkMap)) b.e.SetNetworkMap(new(netmap.NetworkMap))
if err := b.initTKALocked(); err != nil { if err := b.initTKALocked(); err != nil {
b.mu.Unlock()
return err return err
} }
b.lastServeConfJSON = mem.B(nil) b.lastServeConfJSON = mem.B(nil)
b.serveConfig = ipn.ServeConfigView{} b.serveConfig = ipn.ServeConfigView{}
b.enterStateLockedOnEntry(ipn.NoState) // Reset state. b.enterStateLockedOnEntry(ipn.NoState) // Reset state; releases b.mu
health.SetLocalLogConfigHealth(nil) health.SetLocalLogConfigHealth(nil)
return b.Start(ipn.Options{}) return b.Start(ipn.Options{})
} }

Loading…
Cancel
Save