summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Holzinger <pholzing@redhat.com>2021-06-22 16:06:25 +0200
committerMatthew Heon <mheon@redhat.com>2021-06-24 13:38:07 -0400
commitab5e770c4b2bd0933f7a965e7b455ea0a7cdbfa3 (patch)
tree31e798de355f19ea640ebc4ffee2dba2bd8b9284
parentb957bff8b57f6dac862bc073ba249a571a80bca6 (diff)
downloadpodman-ab5e770c4b2bd0933f7a965e7b455ea0a7cdbfa3.tar.gz
podman-ab5e770c4b2bd0933f7a965e7b455ea0a7cdbfa3.tar.bz2
podman-ab5e770c4b2bd0933f7a965e7b455ea0a7cdbfa3.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>
-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 eb515c000..fc1d7df50 100644
--- a/libpod/networking_linux.go
+++ b/libpod/networking_linux.go
@@ -866,6 +866,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