runsc: Fix map access race in boot.Loader.waitContainer.

PiperOrigin-RevId: 204522004
Change-Id: I4819dc025f0a1df03ceaaba7951b1902d44562b3
This commit is contained in:
Nicolas Lacasse
2018-07-13 13:46:14 -07:00
committed by Shentubot
parent 6dce46d4c0
commit 9059983fdb
+3 -1
View File
@@ -499,10 +499,12 @@ func (l *Loader) waitContainer(cid string, waitStatus *uint32) error {
// multiple clients to wait on the same container.
l.mu.Lock()
tgid, ok := l.containerRootTGIDs[cid]
l.mu.Unlock()
if !ok {
defer l.mu.Unlock()
return fmt.Errorf("can't find process for container %q in %v", cid, l.containerRootTGIDs)
}
l.mu.Unlock()
// If the thread either has already exited or exits during waiting,
// consider the container exited.
defer func() {