Lock the NIC when checking if an address is tentative

PiperOrigin-RevId: 291426657
This commit is contained in:
Ghanan Gowripalan 2020-01-24 13:02:01 -08:00 committed by gVisor bot
parent d135b5abf6
commit 878bda6e19
1 changed files with 3 additions and 0 deletions

View File

@ -1208,6 +1208,9 @@ func (n *NIC) Stack() *Stack {
// false. It will only return true if the address is associated with the NIC
// AND it is tentative.
func (n *NIC) isAddrTentative(addr tcpip.Address) bool {
n.mu.RLock()
defer n.mu.RUnlock()
ref, ok := n.mu.endpoints[NetworkEndpointID{addr}]
if !ok {
return false