diff options
author | Ghanan Gowripalan <ghanan@google.com> | 2020-01-24 13:02:01 -0800 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-01-24 13:10:08 -0800 |
commit | 878bda6e19a0d55525ea6b1600f3413e0c5d6a84 (patch) | |
tree | c3f4757fa1530be72278ebdb40daa89c48d579f4 /pkg | |
parent | d135b5abf6eafa92d2745dc98d48ef39d2f90e75 (diff) |
Lock the NIC when checking if an address is tentative
PiperOrigin-RevId: 291426657
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/tcpip/stack/nic.go | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/pkg/tcpip/stack/nic.go b/pkg/tcpip/stack/nic.go index 79556a36f..7dad9a8cb 100644 --- a/pkg/tcpip/stack/nic.go +++ b/pkg/tcpip/stack/nic.go @@ -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 |