summaryrefslogtreecommitdiffhomepage
path: root/pkg/tcpip/stack/neighbor_cache.go
diff options
context:
space:
mode:
authorSam Balana <sbalana@google.com>2020-11-24 15:35:47 -0800
committergVisor bot <gvisor-bot@google.com>2020-11-24 15:37:47 -0800
commit99f2d0ea2f2ec7a9758584d53db64008be33fac4 (patch)
tree88cf16bb18719064b4260ecfa31831099552782d /pkg/tcpip/stack/neighbor_cache.go
parent4da63dc82e1a458404f0e30f8bba9391eb7dd806 (diff)
Correctly lock when removing neighbor entries
Fix a panic when two entries in Failed state are removed at the same time. PiperOrigin-RevId: 344143777
Diffstat (limited to 'pkg/tcpip/stack/neighbor_cache.go')
-rw-r--r--pkg/tcpip/stack/neighbor_cache.go2
1 files changed, 2 insertions, 0 deletions
diff --git a/pkg/tcpip/stack/neighbor_cache.go b/pkg/tcpip/stack/neighbor_cache.go
index 13ea2d1d9..0d3f626cf 100644
--- a/pkg/tcpip/stack/neighbor_cache.go
+++ b/pkg/tcpip/stack/neighbor_cache.go
@@ -233,6 +233,8 @@ func (n *neighborCache) addStaticEntry(addr tcpip.Address, linkAddr tcpip.LinkAd
}
// removeEntryLocked removes the specified entry from the neighbor cache.
+//
+// Prerequisite: n.mu and entry.mu MUST be locked.
func (n *neighborCache) removeEntryLocked(entry *neighborEntry) {
if entry.neigh.State != Static {
n.dynamic.lru.Remove(entry)