Skip to content

Commit

Permalink
IPAM: fix subnet mutex not released when static IP is out of range (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangzujian authored Jun 25, 2023
1 parent 65fd8a4 commit daa436d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/ipam/subnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,7 @@ func (subnet *Subnet) GetStaticAddress(podName, nicName string, ip IP, mac *stri
var v4, v6 bool
isAllocated := false
subnet.mutex.Lock()
defer subnet.mutex.Unlock()

if ip.To4() != nil {
v4 = subnet.V4CIDR != nil
Expand Down Expand Up @@ -355,7 +356,6 @@ func (subnet *Subnet) GetStaticAddress(podName, nicName string, ip IP, mac *stri
pool.V6Using.Add(ip)
}
}
subnet.mutex.Unlock()
}()

var macStr string
Expand Down

0 comments on commit daa436d

Please sign in to comment.