Fix panic on nil map in Fragmentation.

A rare bug occurs when assigning a value to the reassemblers map causes a panic
due to the map being nil. The only way this is possible is if
Fragmentation.Release() is called before Process() is able to finish.

PiperOrigin-RevId: 466771159
This commit is contained in:
Konstantin Bogomolov
2022-08-10 13:25:55 -07:00
committed by gVisor bot
parent 778db1d8bc
commit a4fb3b200f
@@ -175,6 +175,10 @@ func (f *Fragmentation) Process(
}
f.mu.Lock()
if f.reassemblers == nil {
return nil, 0, false, fmt.Errorf("Release() called before fragmentation processing could finish")
}
r, ok := f.reassemblers[id]
if !ok {
r = newReassembler(id, f.clock)