From a84fa194b76dfd1776e01e192529d73ee32389ca Mon Sep 17 00:00:00 2001 From: Paul Holzinger Date: Tue, 22 Jun 2021 16:06:25 +0200 Subject: getContainerNetworkInfo: lock netNsCtr before sync `syncContainer()` requires the container to be locked, otherwise we can end up with undefined behavior. [NO TESTS NEEDED] Signed-off-by: Paul Holzinger --- libpod/networking_linux.go | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'libpod') diff --git a/libpod/networking_linux.go b/libpod/networking_linux.go index 5446841f6..200920a02 100644 --- a/libpod/networking_linux.go +++ b/libpod/networking_linux.go @@ -888,6 +888,10 @@ func (c *Container) getContainerNetworkInfo() (*define.InspectNetworkSettings, e if err != nil { return nil, err } + // see https://github.com/containers/podman/issues/10090 + // the container has to be locked for syncContainer() + netNsCtr.lock.Lock() + defer netNsCtr.lock.Unlock() // Have to sync to ensure that state is populated if err := netNsCtr.syncContainer(); err != nil { return nil, err -- cgit v1.2.3-54-g00ecf