summaryrefslogtreecommitdiff
path: root/libpod/networking_linux.go
diff options
context:
space:
mode:
authorPaul Holzinger <pholzing@redhat.com>2021-06-22 16:06:25 +0200
committerPaul Holzinger <pholzing@redhat.com>2021-06-22 16:51:21 +0200
commita84fa194b76dfd1776e01e192529d73ee32389ca (patch)
treed9c0f6c41654d015b7320b2d834a380fcf1b8230 /libpod/networking_linux.go
parented511d27d7d2198624dcda41b9e06e9e582e5c20 (diff)
downloadpodman-a84fa194b76dfd1776e01e192529d73ee32389ca.tar.gz
podman-a84fa194b76dfd1776e01e192529d73ee32389ca.tar.bz2
podman-a84fa194b76dfd1776e01e192529d73ee32389ca.zip
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 <pholzing@redhat.com>
Diffstat (limited to 'libpod/networking_linux.go')
-rw-r--r--libpod/networking_linux.go4
1 files changed, 4 insertions, 0 deletions
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