From a37ee8483f4b19f61241e272cba6fc81845ef25b Mon Sep 17 00:00:00 2001 From: Tom DNetto Date: Wed, 5 Oct 2022 11:42:30 -0700 Subject: [PATCH] ipn/ipnlocal: fix data race from missing lock in NetworkLockStatus Signed-off-by: Tom DNetto --- ipn/ipnlocal/network-lock.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ipn/ipnlocal/network-lock.go b/ipn/ipnlocal/network-lock.go index 400bd2908..3c0d25911 100644 --- a/ipn/ipnlocal/network-lock.go +++ b/ipn/ipnlocal/network-lock.go @@ -294,6 +294,9 @@ func (b *LocalBackend) CanSupportNetworkLock() error { // NetworkLockStatus returns a structure describing the state of the // tailnet key authority, if any. func (b *LocalBackend) NetworkLockStatus() *ipnstate.NetworkLockStatus { + b.mu.Lock() + defer b.mu.Unlock() + if b.tka == nil { return &ipnstate.NetworkLockStatus{ Enabled: false,