summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry
diff options
context:
space:
mode:
authorTing-Yu Wang <anivia@google.com>2020-06-18 14:28:06 -0700
committergVisor bot <gvisor-bot@google.com>2020-06-18 14:29:42 -0700
commitf97122f44c5c4218bb2239686cd323358c661d60 (patch)
treef94f9eaa69f97ec03fc17753cc0138612b96b63f /pkg/sentry
parentf1aa919181c066039a3022499de8076e523e3e7d (diff)
Acquire lock when accessing MultiDevice's cache in String().
PiperOrigin-RevId: 317180925
Diffstat (limited to 'pkg/sentry')
-rw-r--r--pkg/sentry/device/device.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/pkg/sentry/device/device.go b/pkg/sentry/device/device.go
index 69e71e322..f45b2bd2b 100644
--- a/pkg/sentry/device/device.go
+++ b/pkg/sentry/device/device.go
@@ -188,6 +188,9 @@ type MultiDevice struct {
// String stringifies MultiDevice.
func (m *MultiDevice) String() string {
+ m.mu.Lock()
+ defer m.mu.Unlock()
+
buf := bytes.NewBuffer(nil)
buf.WriteString("cache{")
for k, v := range m.cache {