Acquire lock when accessing MultiDevice's cache in String().

PiperOrigin-RevId: 317180925
This commit is contained in:
Ting-Yu Wang
2020-06-18 14:29:42 -07:00
committed by gVisor bot
parent f1aa919181
commit f97122f44c
+3
View File
@@ -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 {