diff options
author | gVisor bot <gvisor-bot@google.com> | 2020-03-06 20:34:15 +0000 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-03-06 20:34:15 +0000 |
commit | d80c5b0c6b44bb145788d699b8ffac109c5937d6 (patch) | |
tree | 7ff5ca6054a625835c606216a0a4578cfffc285c /pkg/tcpip/network/fragmentation | |
parent | 57eb9dd84e0153bb1848c0246d86ef23d116d9a2 (diff) | |
parent | 6fa5cee82c0f515b001dee5f3840e1f875b2f477 (diff) |
Merge release-20200219.0-122-g6fa5cee (automated)
Diffstat (limited to 'pkg/tcpip/network/fragmentation')
-rw-r--r-- | pkg/tcpip/network/fragmentation/fragmentation.go | 8 | ||||
-rwxr-xr-x | pkg/tcpip/network/fragmentation/reassembler_list.go | 8 |
2 files changed, 11 insertions, 5 deletions
diff --git a/pkg/tcpip/network/fragmentation/fragmentation.go b/pkg/tcpip/network/fragmentation/fragmentation.go index 92f2aa13a..f42abc4bb 100644 --- a/pkg/tcpip/network/fragmentation/fragmentation.go +++ b/pkg/tcpip/network/fragmentation/fragmentation.go @@ -115,10 +115,12 @@ func (f *Fragmentation) Process(id uint32, first, last uint16, more bool, vv buf // Evict reassemblers if we are consuming more memory than highLimit until // we reach lowLimit. if f.size > f.highLimit { - tail := f.rList.Back() - for f.size > f.lowLimit && tail != nil { + for f.size > f.lowLimit { + tail := f.rList.Back() + if tail == nil { + break + } f.release(tail) - tail = tail.Prev() } } f.mu.Unlock() diff --git a/pkg/tcpip/network/fragmentation/reassembler_list.go b/pkg/tcpip/network/fragmentation/reassembler_list.go index d571d7ae5..a48422c97 100755 --- a/pkg/tcpip/network/fragmentation/reassembler_list.go +++ b/pkg/tcpip/network/fragmentation/reassembler_list.go @@ -135,8 +135,9 @@ func (l *reassemblerList) InsertBefore(a, e *reassembler) { // Remove removes e from l. func (l *reassemblerList) Remove(e *reassembler) { - prev := reassemblerElementMapper{}.linkerFor(e).Prev() - next := reassemblerElementMapper{}.linkerFor(e).Next() + linker := reassemblerElementMapper{}.linkerFor(e) + prev := linker.Prev() + next := linker.Next() if prev != nil { reassemblerElementMapper{}.linkerFor(prev).SetNext(next) @@ -149,6 +150,9 @@ func (l *reassemblerList) Remove(e *reassembler) { } else { l.tail = prev } + + linker.SetNext(nil) + linker.SetPrev(nil) } // Entry is a default implementation of Linker. Users can add anonymous fields |