summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorgVisor bot <gvisor-bot@google.com>2020-12-02 05:38:56 +0000
committergVisor bot <gvisor-bot@google.com>2020-12-02 05:38:56 +0000
commitc00b31f29b73d29fd2289a45ee535948dd9cbf1d (patch)
treee628d727e03b0d54671770bd45f116c6be4c7f74
parent8a4d72807c9ea91568b43a6fd5dfcd3726dfdb5f (diff)
parent0c497394226b762dfd31b83bb33043d19073b0a4 (diff)
Merge release-20201117.0-88-g0c4973942 (automated)
-rw-r--r--pkg/tcpip/stack/neighbor_cache.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/pkg/tcpip/stack/neighbor_cache.go b/pkg/tcpip/stack/neighbor_cache.go
index 0d3f626cf..317f6871d 100644
--- a/pkg/tcpip/stack/neighbor_cache.go
+++ b/pkg/tcpip/stack/neighbor_cache.go
@@ -182,14 +182,15 @@ func (n *neighborCache) removeWaker(addr tcpip.Address, waker *sleep.Waker) {
// entries returns all entries in the neighbor cache.
func (n *neighborCache) entries() []NeighborEntry {
- entries := make([]NeighborEntry, 0, len(n.cache))
n.mu.RLock()
+ defer n.mu.RUnlock()
+
+ entries := make([]NeighborEntry, 0, len(n.cache))
for _, entry := range n.cache {
entry.mu.RLock()
entries = append(entries, entry.neigh)
entry.mu.RUnlock()
}
- n.mu.RUnlock()
return entries
}