summaryrefslogtreecommitdiffhomepage
path: root/pkg/tcpip/stack
diff options
context:
space:
mode:
authorgVisor bot <gvisor-bot@google.com>2021-02-25 21:40:11 +0000
committergVisor bot <gvisor-bot@google.com>2021-02-25 21:40:11 +0000
commitc35f73b493fe684c1bee9c7218ab8e8c43a5523e (patch)
tree3821f46106ae0552532282160263e9c41eab36e2 /pkg/tcpip/stack
parentca7a3c34629c390485c923f897392f8d3b09ae5f (diff)
parent38c42bbf4ad2200f0ec72e51d1cfbbd83d782a63 (diff)
Merge release-20210208.0-97-g38c42bbf4 (automated)
Diffstat (limited to 'pkg/tcpip/stack')
-rw-r--r--pkg/tcpip/stack/transport_demuxer.go11
1 files changed, 6 insertions, 5 deletions
diff --git a/pkg/tcpip/stack/transport_demuxer.go b/pkg/tcpip/stack/transport_demuxer.go
index 292e51d20..61cbaf688 100644
--- a/pkg/tcpip/stack/transport_demuxer.go
+++ b/pkg/tcpip/stack/transport_demuxer.go
@@ -582,17 +582,18 @@ func (d *transportDemuxer) deliverRawPacket(protocol tcpip.TransportProtocolNumb
// As in net/ipv4/ip_input.c:ip_local_deliver, attempt to deliver via
// raw endpoint first. If there are multiple raw endpoints, they all
// receive the packet.
- foundRaw := false
eps.mu.RLock()
- for _, rawEP := range eps.rawEndpoints {
+ // Copy the list of raw endpoints so we can release eps.mu earlier.
+ rawEPs := make([]RawTransportEndpoint, len(eps.rawEndpoints))
+ copy(rawEPs, eps.rawEndpoints)
+ eps.mu.RUnlock()
+ for _, rawEP := range rawEPs {
// Each endpoint gets its own copy of the packet for the sake
// of save/restore.
rawEP.HandlePacket(pkt.Clone())
- foundRaw = true
}
- eps.mu.RUnlock()
- return foundRaw
+ return len(rawEPs) > 0
}
// deliverError attempts to deliver the given error to the appropriate transport