mirror of
https://github.com/moby/moby.git
synced 2026-08-04 15:11:00 +00:00
d/libnetwork: fix (*Controller).getLBIndex panics
Check the serviceBinding's deleted flag to guard against the service getting deleted before we locked its mutex, which would make it futile to look up the load balancers. And guard against dereferencing a nil *loadBalancer in general. Signed-off-by: Cory Snider <csnider@mirantis.com>
This commit is contained in:
@@ -160,9 +160,14 @@ func (c *Controller) getLBIndex(sid, nid string, ingressPorts []*PortConfig) int
|
||||
}
|
||||
|
||||
s.Lock()
|
||||
defer s.Unlock()
|
||||
if s.deleted {
|
||||
return 0
|
||||
}
|
||||
lb := s.loadBalancers[nid]
|
||||
s.Unlock()
|
||||
|
||||
if lb == nil {
|
||||
return 0
|
||||
}
|
||||
return int(lb.fwMark)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user