mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
bridge: DeliverNetworkPacket has to take the read lock
It doesn't change bridge attributes. PiperOrigin-RevId: 654152787
This commit is contained in:
@@ -36,7 +36,7 @@ func (p *bridgePort) ParseHeader(pkt *PacketBuffer) bool {
|
||||
// DeliverNetworkPacket implements stack.NetworkDispatcher.
|
||||
func (p *bridgePort) DeliverNetworkPacket(protocol tcpip.NetworkProtocolNumber, pkt *PacketBuffer) {
|
||||
bridge := p.bridge
|
||||
bridge.mu.Lock()
|
||||
bridge.mu.RLock()
|
||||
|
||||
// Send the packet to all other ports.
|
||||
for _, port := range bridge.ports {
|
||||
@@ -52,7 +52,7 @@ func (p *bridgePort) DeliverNetworkPacket(protocol tcpip.NetworkProtocolNumber,
|
||||
}
|
||||
|
||||
d := bridge.dispatcher
|
||||
bridge.mu.Unlock()
|
||||
bridge.mu.RUnlock()
|
||||
if d != nil {
|
||||
// The dispatcher may acquire Stack.mu in DeliverNetworkPacket(), which is
|
||||
// ordered above bridge.mu. So call DeliverNetworkPacket() without holding
|
||||
|
||||
Reference in New Issue
Block a user