From 86b6ff61e6de60e3ab6b671fe177e5b85e5d561a Mon Sep 17 00:00:00 2001
From: Maisem Ali <maisem@tailscale.com>
Date: Fri, 2 Dec 2022 23:04:00 +0500
Subject: [PATCH] ipn/ipnlocal: fix Prefs access without mu being held

Noticed while working on a different fix.

Signed-off-by: Maisem Ali <maisem@tailscale.com>
---
 ipn/ipnlocal/local.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ipn/ipnlocal/local.go b/ipn/ipnlocal/local.go
index dca383ba7..39090f8fa 100644
--- a/ipn/ipnlocal/local.go
+++ b/ipn/ipnlocal/local.go
@@ -1167,8 +1167,8 @@ func (b *LocalBackend) Start(opts ipn.Options) error {
 		b.logf("Start: already running; sending notify")
 		nm := b.netMap
 		state := b.state
-		b.mu.Unlock()
 		p := b.pm.CurrentPrefs()
+		b.mu.Unlock()
 		b.send(ipn.Notify{
 			State:         &state,
 			NetMap:        nm,