Fix race during fdbased endpoint teardown.

If the fdbased processor is handling packets and the endpoint dispatcher
concurrently is set to nil we can crash the sandbox.

PiperOrigin-RevId: 634007307
This commit is contained in:
Lucas Manning
2024-05-15 10:55:26 -07:00
committed by gVisor bot
parent e367e0b134
commit 6a7e4c2102
+6
View File
@@ -62,6 +62,12 @@ func (p *processor) deliverPackets() {
p.e.mu.RLock()
p.gro.Dispatcher = p.e.dispatcher
p.e.mu.RUnlock()
if p.gro.Dispatcher == nil {
p.mu.Lock()
p.pkts.Reset()
p.mu.Unlock()
return
}
p.mu.Lock()
for p.pkts.Len() > 0 {