mirror of https://github.com/containers/podman.git
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>
This commit is contained in:
parent
ed511d27d7
commit
a84fa194b7
|
@ -888,6 +888,10 @@ func (c *Container) getContainerNetworkInfo() (*define.InspectNetworkSettings, e
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
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
|
// Have to sync to ensure that state is populated
|
||||||
if err := netNsCtr.syncContainer(); err != nil {
|
if err := netNsCtr.syncContainer(); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
Loading…
Reference in New Issue