diff options
author | Ting-Yu Wang <anivia@google.com> | 2020-06-18 14:28:06 -0700 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-06-18 14:29:42 -0700 |
commit | f97122f44c5c4218bb2239686cd323358c661d60 (patch) | |
tree | f94f9eaa69f97ec03fc17753cc0138612b96b63f | |
parent | f1aa919181c066039a3022499de8076e523e3e7d (diff) |
Acquire lock when accessing MultiDevice's cache in String().
PiperOrigin-RevId: 317180925
-rw-r--r-- | pkg/sentry/device/device.go | 3 |
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 { |