mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Fixing concurrent map access
This commit fixes panic due to concurrent map access Signed-off-by: Abhinandan Prativadi <abhi@docker.com>
This commit is contained in:
parent
6a8a15dd9d
commit
fe629b6eba
1 changed files with 4 additions and 4 deletions
|
@ -402,15 +402,15 @@ func (a *Allocator) getPredefinedPool(as string, ipV6 bool) (*net.IPNet, error)
|
|||
continue
|
||||
}
|
||||
aSpace.Lock()
|
||||
_, ok := aSpace.subnets[SubnetKey{AddressSpace: as, Subnet: nw.String()}]
|
||||
aSpace.Unlock()
|
||||
if ok {
|
||||
if _, ok := aSpace.subnets[SubnetKey{AddressSpace: as, Subnet: nw.String()}]; ok {
|
||||
aSpace.Unlock()
|
||||
continue
|
||||
}
|
||||
|
||||
if !aSpace.contains(as, nw) {
|
||||
aSpace.Unlock()
|
||||
return nw, nil
|
||||
}
|
||||
aSpace.Unlock()
|
||||
}
|
||||
|
||||
return nil, types.NotFoundErrorf("could not find an available, non-overlapping IPv%d address pool among the defaults to assign to the network", v)
|
||||
|
|
Loading…
Add table
Reference in a new issue