summaryrefslogtreecommitdiffhomepage
path: root/pkg
diff options
context:
space:
mode:
authorgVisor bot <gvisor-bot@google.com>2020-03-06 20:34:15 +0000
committergVisor bot <gvisor-bot@google.com>2020-03-06 20:34:15 +0000
commitd80c5b0c6b44bb145788d699b8ffac109c5937d6 (patch)
tree7ff5ca6054a625835c606216a0a4578cfffc285c /pkg
parent57eb9dd84e0153bb1848c0246d86ef23d116d9a2 (diff)
parent6fa5cee82c0f515b001dee5f3840e1f875b2f477 (diff)
Merge release-20200219.0-122-g6fa5cee (automated)
Diffstat (limited to 'pkg')
-rwxr-xr-xpkg/buffer/buffer_list.go8
-rwxr-xr-xpkg/ilist/interface_list.go8
-rwxr-xr-xpkg/refs/weak_ref_list.go8
-rw-r--r--pkg/sentry/fs/dirent_cache.go2
-rwxr-xr-xpkg/sentry/fs/dirent_list.go8
-rwxr-xr-xpkg/sentry/fs/event_list.go8
-rw-r--r--pkg/sentry/fs/inotify.go5
-rwxr-xr-xpkg/sentry/kernel/epoll/epoll_list.go8
-rw-r--r--pkg/sentry/kernel/epoll/epoll_state.go13
-rwxr-xr-xpkg/sentry/kernel/futex/waiter_list.go8
-rwxr-xr-xpkg/sentry/kernel/pending_signals_list.go8
-rwxr-xr-xpkg/sentry/kernel/process_group_list.go8
-rwxr-xr-xpkg/sentry/kernel/semaphore/waiter_list.go8
-rwxr-xr-xpkg/sentry/kernel/session_list.go8
-rwxr-xr-xpkg/sentry/kernel/socket_list.go8
-rwxr-xr-xpkg/sentry/kernel/task_list.go8
-rwxr-xr-xpkg/sentry/mm/io_list.go8
-rwxr-xr-xpkg/sentry/socket/unix/transport/transport_message_list.go8
-rwxr-xr-xpkg/sentry/vfs/epoll_interest_list.go8
-rw-r--r--pkg/tcpip/network/fragmentation/fragmentation.go8
-rwxr-xr-xpkg/tcpip/network/fragmentation/reassembler_list.go8
-rwxr-xr-xpkg/tcpip/stack/linkaddrentry_list.go8
-rwxr-xr-xpkg/tcpip/transport/icmp/icmp_packet_list.go8
-rwxr-xr-xpkg/tcpip/transport/packet/packet_list.go8
-rwxr-xr-xpkg/tcpip/transport/raw/raw_packet_list.go8
-rwxr-xr-xpkg/tcpip/transport/tcp/tcp_endpoint_list.go8
-rwxr-xr-xpkg/tcpip/transport/tcp/tcp_segment_list.go8
-rwxr-xr-xpkg/tcpip/transport/udp/udp_packet_list.go8
-rwxr-xr-xpkg/waiter/waiter_list.go8
29 files changed, 167 insertions, 61 deletions
diff --git a/pkg/buffer/buffer_list.go b/pkg/buffer/buffer_list.go
index 18dcf2608..acada55a0 100755
--- a/pkg/buffer/buffer_list.go
+++ b/pkg/buffer/buffer_list.go
@@ -135,8 +135,9 @@ func (l *bufferList) InsertBefore(a, e *Buffer) {
// Remove removes e from l.
func (l *bufferList) Remove(e *Buffer) {
- prev := bufferElementMapper{}.linkerFor(e).Prev()
- next := bufferElementMapper{}.linkerFor(e).Next()
+ linker := bufferElementMapper{}.linkerFor(e)
+ prev := linker.Prev()
+ next := linker.Next()
if prev != nil {
bufferElementMapper{}.linkerFor(prev).SetNext(next)
@@ -149,6 +150,9 @@ func (l *bufferList) Remove(e *Buffer) {
} else {
l.tail = prev
}
+
+ linker.SetNext(nil)
+ linker.SetPrev(nil)
}
// Entry is a default implementation of Linker. Users can add anonymous fields
diff --git a/pkg/ilist/interface_list.go b/pkg/ilist/interface_list.go
index a69f736c6..aeb636f52 100755
--- a/pkg/ilist/interface_list.go
+++ b/pkg/ilist/interface_list.go
@@ -154,8 +154,9 @@ func (l *List) InsertBefore(a, e Element) {
// Remove removes e from l.
func (l *List) Remove(e Element) {
- prev := ElementMapper{}.linkerFor(e).Prev()
- next := ElementMapper{}.linkerFor(e).Next()
+ linker := ElementMapper{}.linkerFor(e)
+ prev := linker.Prev()
+ next := linker.Next()
if prev != nil {
ElementMapper{}.linkerFor(prev).SetNext(next)
@@ -168,6 +169,9 @@ func (l *List) Remove(e Element) {
} else {
l.tail = prev
}
+
+ linker.SetNext(nil)
+ linker.SetPrev(nil)
}
// Entry is a default implementation of Linker. Users can add anonymous fields
diff --git a/pkg/refs/weak_ref_list.go b/pkg/refs/weak_ref_list.go
index 19daf9ab0..1d0ae2099 100755
--- a/pkg/refs/weak_ref_list.go
+++ b/pkg/refs/weak_ref_list.go
@@ -135,8 +135,9 @@ func (l *weakRefList) InsertBefore(a, e *WeakRef) {
// Remove removes e from l.
func (l *weakRefList) Remove(e *WeakRef) {
- prev := weakRefElementMapper{}.linkerFor(e).Prev()
- next := weakRefElementMapper{}.linkerFor(e).Next()
+ linker := weakRefElementMapper{}.linkerFor(e)
+ prev := linker.Prev()
+ next := linker.Next()
if prev != nil {
weakRefElementMapper{}.linkerFor(prev).SetNext(next)
@@ -149,6 +150,9 @@ func (l *weakRefList) Remove(e *WeakRef) {
} else {
l.tail = prev
}
+
+ linker.SetNext(nil)
+ linker.SetPrev(nil)
}
// Entry is a default implementation of Linker. Users can add anonymous fields
diff --git a/pkg/sentry/fs/dirent_cache.go b/pkg/sentry/fs/dirent_cache.go
index 25514ace4..33de32c69 100644
--- a/pkg/sentry/fs/dirent_cache.go
+++ b/pkg/sentry/fs/dirent_cache.go
@@ -101,8 +101,6 @@ func (c *DirentCache) remove(d *Dirent) {
panic(fmt.Sprintf("trying to remove %v, which is not in the dirent cache", d))
}
c.list.Remove(d)
- d.SetPrev(nil)
- d.SetNext(nil)
d.DecRef()
c.currentSize--
if c.limit != nil {
diff --git a/pkg/sentry/fs/dirent_list.go b/pkg/sentry/fs/dirent_list.go
index 49d25da6c..acdce100c 100755
--- a/pkg/sentry/fs/dirent_list.go
+++ b/pkg/sentry/fs/dirent_list.go
@@ -135,8 +135,9 @@ func (l *direntList) InsertBefore(a, e *Dirent) {
// Remove removes e from l.
func (l *direntList) Remove(e *Dirent) {
- prev := direntElementMapper{}.linkerFor(e).Prev()
- next := direntElementMapper{}.linkerFor(e).Next()
+ linker := direntElementMapper{}.linkerFor(e)
+ prev := linker.Prev()
+ next := linker.Next()
if prev != nil {
direntElementMapper{}.linkerFor(prev).SetNext(next)
@@ -149,6 +150,9 @@ func (l *direntList) Remove(e *Dirent) {
} else {
l.tail = prev
}
+
+ linker.SetNext(nil)
+ linker.SetPrev(nil)
}
// Entry is a default implementation of Linker. Users can add anonymous fields
diff --git a/pkg/sentry/fs/event_list.go b/pkg/sentry/fs/event_list.go
index 786686592..0274f41a2 100755
--- a/pkg/sentry/fs/event_list.go
+++ b/pkg/sentry/fs/event_list.go
@@ -135,8 +135,9 @@ func (l *eventList) InsertBefore(a, e *Event) {
// Remove removes e from l.
func (l *eventList) Remove(e *Event) {
- prev := eventElementMapper{}.linkerFor(e).Prev()
- next := eventElementMapper{}.linkerFor(e).Next()
+ linker := eventElementMapper{}.linkerFor(e)
+ prev := linker.Prev()
+ next := linker.Next()
if prev != nil {
eventElementMapper{}.linkerFor(prev).SetNext(next)
@@ -149,6 +150,9 @@ func (l *eventList) Remove(e *Event) {
} else {
l.tail = prev
}
+
+ linker.SetNext(nil)
+ linker.SetPrev(nil)
}
// Entry is a default implementation of Linker. Users can add anonymous fields
diff --git a/pkg/sentry/fs/inotify.go b/pkg/sentry/fs/inotify.go
index 928c90aa0..e3a715c1f 100644
--- a/pkg/sentry/fs/inotify.go
+++ b/pkg/sentry/fs/inotify.go
@@ -143,7 +143,10 @@ func (i *Inotify) Read(ctx context.Context, _ *File, dst usermem.IOSequence, _ i
}
var writeLen int64
- for event := i.events.Front(); event != nil; event = event.Next() {
+ for it := i.events.Front(); it != nil; {
+ event := it
+ it = it.Next()
+
// Does the buffer have enough remaining space to hold the event we're
// about to write out?
if dst.NumBytes() < int64(event.sizeOf()) {
diff --git a/pkg/sentry/kernel/epoll/epoll_list.go b/pkg/sentry/kernel/epoll/epoll_list.go
index 5ac854e38..37f757fa8 100755
--- a/pkg/sentry/kernel/epoll/epoll_list.go
+++ b/pkg/sentry/kernel/epoll/epoll_list.go
@@ -135,8 +135,9 @@ func (l *pollEntryList) InsertBefore(a, e *pollEntry) {
// Remove removes e from l.
func (l *pollEntryList) Remove(e *pollEntry) {
- prev := pollEntryElementMapper{}.linkerFor(e).Prev()
- next := pollEntryElementMapper{}.linkerFor(e).Next()
+ linker := pollEntryElementMapper{}.linkerFor(e)
+ prev := linker.Prev()
+ next := linker.Next()
if prev != nil {
pollEntryElementMapper{}.linkerFor(prev).SetNext(next)
@@ -149,6 +150,9 @@ func (l *pollEntryList) Remove(e *pollEntry) {
} else {
l.tail = prev
}
+
+ linker.SetNext(nil)
+ linker.SetPrev(nil)
}
// Entry is a default implementation of Linker. Users can add anonymous fields
diff --git a/pkg/sentry/kernel/epoll/epoll_state.go b/pkg/sentry/kernel/epoll/epoll_state.go
index a0d35d350..8e9f200d0 100644
--- a/pkg/sentry/kernel/epoll/epoll_state.go
+++ b/pkg/sentry/kernel/epoll/epoll_state.go
@@ -38,11 +38,14 @@ func (e *EventPoll) afterLoad() {
}
}
- for it := e.waitingList.Front(); it != nil; it = it.Next() {
- if it.id.File.Readiness(it.mask) != 0 {
- e.waitingList.Remove(it)
- e.readyList.PushBack(it)
- it.curList = &e.readyList
+ for it := e.waitingList.Front(); it != nil; {
+ entry := it
+ it = it.Next()
+
+ if entry.id.File.Readiness(entry.mask) != 0 {
+ e.waitingList.Remove(entry)
+ e.readyList.PushBack(entry)
+ entry.curList = &e.readyList
e.Notify(waiter.EventIn)
}
}
diff --git a/pkg/sentry/kernel/futex/waiter_list.go b/pkg/sentry/kernel/futex/waiter_list.go
index b6baa1b5b..204eededf 100755
--- a/pkg/sentry/kernel/futex/waiter_list.go
+++ b/pkg/sentry/kernel/futex/waiter_list.go
@@ -135,8 +135,9 @@ func (l *waiterList) InsertBefore(a, e *Waiter) {
// Remove removes e from l.
func (l *waiterList) Remove(e *Waiter) {
- prev := waiterElementMapper{}.linkerFor(e).Prev()
- next := waiterElementMapper{}.linkerFor(e).Next()
+ linker := waiterElementMapper{}.linkerFor(e)
+ prev := linker.Prev()
+ next := linker.Next()
if prev != nil {
waiterElementMapper{}.linkerFor(prev).SetNext(next)
@@ -149,6 +150,9 @@ func (l *waiterList) Remove(e *Waiter) {
} else {
l.tail = prev
}
+
+ linker.SetNext(nil)
+ linker.SetPrev(nil)
}
// Entry is a default implementation of Linker. Users can add anonymous fields
diff --git a/pkg/sentry/kernel/pending_signals_list.go b/pkg/sentry/kernel/pending_signals_list.go
index 26b9ffd98..8eb40ac2c 100755
--- a/pkg/sentry/kernel/pending_signals_list.go
+++ b/pkg/sentry/kernel/pending_signals_list.go
@@ -135,8 +135,9 @@ func (l *pendingSignalList) InsertBefore(a, e *pendingSignal) {
// Remove removes e from l.
func (l *pendingSignalList) Remove(e *pendingSignal) {
- prev := pendingSignalElementMapper{}.linkerFor(e).Prev()
- next := pendingSignalElementMapper{}.linkerFor(e).Next()
+ linker := pendingSignalElementMapper{}.linkerFor(e)
+ prev := linker.Prev()
+ next := linker.Next()
if prev != nil {
pendingSignalElementMapper{}.linkerFor(prev).SetNext(next)
@@ -149,6 +150,9 @@ func (l *pendingSignalList) Remove(e *pendingSignal) {
} else {
l.tail = prev
}
+
+ linker.SetNext(nil)
+ linker.SetPrev(nil)
}
// Entry is a default implementation of Linker. Users can add anonymous fields
diff --git a/pkg/sentry/kernel/process_group_list.go b/pkg/sentry/kernel/process_group_list.go
index 2c5363c69..40c1a13a4 100755
--- a/pkg/sentry/kernel/process_group_list.go
+++ b/pkg/sentry/kernel/process_group_list.go
@@ -135,8 +135,9 @@ func (l *processGroupList) InsertBefore(a, e *ProcessGroup) {
// Remove removes e from l.
func (l *processGroupList) Remove(e *ProcessGroup) {
- prev := processGroupElementMapper{}.linkerFor(e).Prev()
- next := processGroupElementMapper{}.linkerFor(e).Next()
+ linker := processGroupElementMapper{}.linkerFor(e)
+ prev := linker.Prev()
+ next := linker.Next()
if prev != nil {
processGroupElementMapper{}.linkerFor(prev).SetNext(next)
@@ -149,6 +150,9 @@ func (l *processGroupList) Remove(e *ProcessGroup) {
} else {
l.tail = prev
}
+
+ linker.SetNext(nil)
+ linker.SetPrev(nil)
}
// Entry is a default implementation of Linker. Users can add anonymous fields
diff --git a/pkg/sentry/kernel/semaphore/waiter_list.go b/pkg/sentry/kernel/semaphore/waiter_list.go
index 78d86900a..27120afe3 100755
--- a/pkg/sentry/kernel/semaphore/waiter_list.go
+++ b/pkg/sentry/kernel/semaphore/waiter_list.go
@@ -135,8 +135,9 @@ func (l *waiterList) InsertBefore(a, e *waiter) {
// Remove removes e from l.
func (l *waiterList) Remove(e *waiter) {
- prev := waiterElementMapper{}.linkerFor(e).Prev()
- next := waiterElementMapper{}.linkerFor(e).Next()
+ linker := waiterElementMapper{}.linkerFor(e)
+ prev := linker.Prev()
+ next := linker.Next()
if prev != nil {
waiterElementMapper{}.linkerFor(prev).SetNext(next)
@@ -149,6 +150,9 @@ func (l *waiterList) Remove(e *waiter) {
} else {
l.tail = prev
}
+
+ linker.SetNext(nil)
+ linker.SetPrev(nil)
}
// Entry is a default implementation of Linker. Users can add anonymous fields
diff --git a/pkg/sentry/kernel/session_list.go b/pkg/sentry/kernel/session_list.go
index e65688f53..8174f413d 100755
--- a/pkg/sentry/kernel/session_list.go
+++ b/pkg/sentry/kernel/session_list.go
@@ -135,8 +135,9 @@ func (l *sessionList) InsertBefore(a, e *Session) {
// Remove removes e from l.
func (l *sessionList) Remove(e *Session) {
- prev := sessionElementMapper{}.linkerFor(e).Prev()
- next := sessionElementMapper{}.linkerFor(e).Next()
+ linker := sessionElementMapper{}.linkerFor(e)
+ prev := linker.Prev()
+ next := linker.Next()
if prev != nil {
sessionElementMapper{}.linkerFor(prev).SetNext(next)
@@ -149,6 +150,9 @@ func (l *sessionList) Remove(e *Session) {
} else {
l.tail = prev
}
+
+ linker.SetNext(nil)
+ linker.SetPrev(nil)
}
// Entry is a default implementation of Linker. Users can add anonymous fields
diff --git a/pkg/sentry/kernel/socket_list.go b/pkg/sentry/kernel/socket_list.go
index a3d47e381..ac93e2365 100755
--- a/pkg/sentry/kernel/socket_list.go
+++ b/pkg/sentry/kernel/socket_list.go
@@ -135,8 +135,9 @@ func (l *socketList) InsertBefore(a, e *SocketEntry) {
// Remove removes e from l.
func (l *socketList) Remove(e *SocketEntry) {
- prev := socketElementMapper{}.linkerFor(e).Prev()
- next := socketElementMapper{}.linkerFor(e).Next()
+ linker := socketElementMapper{}.linkerFor(e)
+ prev := linker.Prev()
+ next := linker.Next()
if prev != nil {
socketElementMapper{}.linkerFor(prev).SetNext(next)
@@ -149,6 +150,9 @@ func (l *socketList) Remove(e *SocketEntry) {
} else {
l.tail = prev
}
+
+ linker.SetNext(nil)
+ linker.SetPrev(nil)
}
// Entry is a default implementation of Linker. Users can add anonymous fields
diff --git a/pkg/sentry/kernel/task_list.go b/pkg/sentry/kernel/task_list.go
index 9b8f07b46..4dfcdbf2c 100755
--- a/pkg/sentry/kernel/task_list.go
+++ b/pkg/sentry/kernel/task_list.go
@@ -135,8 +135,9 @@ func (l *taskList) InsertBefore(a, e *Task) {
// Remove removes e from l.
func (l *taskList) Remove(e *Task) {
- prev := taskElementMapper{}.linkerFor(e).Prev()
- next := taskElementMapper{}.linkerFor(e).Next()
+ linker := taskElementMapper{}.linkerFor(e)
+ prev := linker.Prev()
+ next := linker.Next()
if prev != nil {
taskElementMapper{}.linkerFor(prev).SetNext(next)
@@ -149,6 +150,9 @@ func (l *taskList) Remove(e *Task) {
} else {
l.tail = prev
}
+
+ linker.SetNext(nil)
+ linker.SetPrev(nil)
}
// Entry is a default implementation of Linker. Users can add anonymous fields
diff --git a/pkg/sentry/mm/io_list.go b/pkg/sentry/mm/io_list.go
index ecb9d4b04..287e4305c 100755
--- a/pkg/sentry/mm/io_list.go
+++ b/pkg/sentry/mm/io_list.go
@@ -135,8 +135,9 @@ func (l *ioList) InsertBefore(a, e *ioResult) {
// Remove removes e from l.
func (l *ioList) Remove(e *ioResult) {
- prev := ioElementMapper{}.linkerFor(e).Prev()
- next := ioElementMapper{}.linkerFor(e).Next()
+ linker := ioElementMapper{}.linkerFor(e)
+ prev := linker.Prev()
+ next := linker.Next()
if prev != nil {
ioElementMapper{}.linkerFor(prev).SetNext(next)
@@ -149,6 +150,9 @@ func (l *ioList) Remove(e *ioResult) {
} else {
l.tail = prev
}
+
+ linker.SetNext(nil)
+ linker.SetPrev(nil)
}
// Entry is a default implementation of Linker. Users can add anonymous fields
diff --git a/pkg/sentry/socket/unix/transport/transport_message_list.go b/pkg/sentry/socket/unix/transport/transport_message_list.go
index 565a821bd..9edc731b4 100755
--- a/pkg/sentry/socket/unix/transport/transport_message_list.go
+++ b/pkg/sentry/socket/unix/transport/transport_message_list.go
@@ -135,8 +135,9 @@ func (l *messageList) InsertBefore(a, e *message) {
// Remove removes e from l.
func (l *messageList) Remove(e *message) {
- prev := messageElementMapper{}.linkerFor(e).Prev()
- next := messageElementMapper{}.linkerFor(e).Next()
+ linker := messageElementMapper{}.linkerFor(e)
+ prev := linker.Prev()
+ next := linker.Next()
if prev != nil {
messageElementMapper{}.linkerFor(prev).SetNext(next)
@@ -149,6 +150,9 @@ func (l *messageList) Remove(e *message) {
} else {
l.tail = prev
}
+
+ linker.SetNext(nil)
+ linker.SetPrev(nil)
}
// Entry is a default implementation of Linker. Users can add anonymous fields
diff --git a/pkg/sentry/vfs/epoll_interest_list.go b/pkg/sentry/vfs/epoll_interest_list.go
index 011373f0f..1bd41f400 100755
--- a/pkg/sentry/vfs/epoll_interest_list.go
+++ b/pkg/sentry/vfs/epoll_interest_list.go
@@ -135,8 +135,9 @@ func (l *epollInterestList) InsertBefore(a, e *epollInterest) {
// Remove removes e from l.
func (l *epollInterestList) Remove(e *epollInterest) {
- prev := epollInterestElementMapper{}.linkerFor(e).Prev()
- next := epollInterestElementMapper{}.linkerFor(e).Next()
+ linker := epollInterestElementMapper{}.linkerFor(e)
+ prev := linker.Prev()
+ next := linker.Next()
if prev != nil {
epollInterestElementMapper{}.linkerFor(prev).SetNext(next)
@@ -149,6 +150,9 @@ func (l *epollInterestList) Remove(e *epollInterest) {
} else {
l.tail = prev
}
+
+ linker.SetNext(nil)
+ linker.SetPrev(nil)
}
// Entry is a default implementation of Linker. Users can add anonymous fields
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
diff --git a/pkg/tcpip/stack/linkaddrentry_list.go b/pkg/tcpip/stack/linkaddrentry_list.go
index 1494aeca1..6697281cd 100755
--- a/pkg/tcpip/stack/linkaddrentry_list.go
+++ b/pkg/tcpip/stack/linkaddrentry_list.go
@@ -135,8 +135,9 @@ func (l *linkAddrEntryList) InsertBefore(a, e *linkAddrEntry) {
// Remove removes e from l.
func (l *linkAddrEntryList) Remove(e *linkAddrEntry) {
- prev := linkAddrEntryElementMapper{}.linkerFor(e).Prev()
- next := linkAddrEntryElementMapper{}.linkerFor(e).Next()
+ linker := linkAddrEntryElementMapper{}.linkerFor(e)
+ prev := linker.Prev()
+ next := linker.Next()
if prev != nil {
linkAddrEntryElementMapper{}.linkerFor(prev).SetNext(next)
@@ -149,6 +150,9 @@ func (l *linkAddrEntryList) Remove(e *linkAddrEntry) {
} else {
l.tail = prev
}
+
+ linker.SetNext(nil)
+ linker.SetPrev(nil)
}
// Entry is a default implementation of Linker. Users can add anonymous fields
diff --git a/pkg/tcpip/transport/icmp/icmp_packet_list.go b/pkg/tcpip/transport/icmp/icmp_packet_list.go
index deeab60ae..ddee31adb 100755
--- a/pkg/tcpip/transport/icmp/icmp_packet_list.go
+++ b/pkg/tcpip/transport/icmp/icmp_packet_list.go
@@ -135,8 +135,9 @@ func (l *icmpPacketList) InsertBefore(a, e *icmpPacket) {
// Remove removes e from l.
func (l *icmpPacketList) Remove(e *icmpPacket) {
- prev := icmpPacketElementMapper{}.linkerFor(e).Prev()
- next := icmpPacketElementMapper{}.linkerFor(e).Next()
+ linker := icmpPacketElementMapper{}.linkerFor(e)
+ prev := linker.Prev()
+ next := linker.Next()
if prev != nil {
icmpPacketElementMapper{}.linkerFor(prev).SetNext(next)
@@ -149,6 +150,9 @@ func (l *icmpPacketList) Remove(e *icmpPacket) {
} else {
l.tail = prev
}
+
+ linker.SetNext(nil)
+ linker.SetPrev(nil)
}
// Entry is a default implementation of Linker. Users can add anonymous fields
diff --git a/pkg/tcpip/transport/packet/packet_list.go b/pkg/tcpip/transport/packet/packet_list.go
index e8c4cba0d..ad27c7c06 100755
--- a/pkg/tcpip/transport/packet/packet_list.go
+++ b/pkg/tcpip/transport/packet/packet_list.go
@@ -135,8 +135,9 @@ func (l *packetList) InsertBefore(a, e *packet) {
// Remove removes e from l.
func (l *packetList) Remove(e *packet) {
- prev := packetElementMapper{}.linkerFor(e).Prev()
- next := packetElementMapper{}.linkerFor(e).Next()
+ linker := packetElementMapper{}.linkerFor(e)
+ prev := linker.Prev()
+ next := linker.Next()
if prev != nil {
packetElementMapper{}.linkerFor(prev).SetNext(next)
@@ -149,6 +150,9 @@ func (l *packetList) Remove(e *packet) {
} else {
l.tail = prev
}
+
+ linker.SetNext(nil)
+ linker.SetPrev(nil)
}
// Entry is a default implementation of Linker. Users can add anonymous fields
diff --git a/pkg/tcpip/transport/raw/raw_packet_list.go b/pkg/tcpip/transport/raw/raw_packet_list.go
index a0138e8cc..e8c1bc997 100755
--- a/pkg/tcpip/transport/raw/raw_packet_list.go
+++ b/pkg/tcpip/transport/raw/raw_packet_list.go
@@ -135,8 +135,9 @@ func (l *rawPacketList) InsertBefore(a, e *rawPacket) {
// Remove removes e from l.
func (l *rawPacketList) Remove(e *rawPacket) {
- prev := rawPacketElementMapper{}.linkerFor(e).Prev()
- next := rawPacketElementMapper{}.linkerFor(e).Next()
+ linker := rawPacketElementMapper{}.linkerFor(e)
+ prev := linker.Prev()
+ next := linker.Next()
if prev != nil {
rawPacketElementMapper{}.linkerFor(prev).SetNext(next)
@@ -149,6 +150,9 @@ func (l *rawPacketList) Remove(e *rawPacket) {
} else {
l.tail = prev
}
+
+ linker.SetNext(nil)
+ linker.SetPrev(nil)
}
// Entry is a default implementation of Linker. Users can add anonymous fields
diff --git a/pkg/tcpip/transport/tcp/tcp_endpoint_list.go b/pkg/tcpip/transport/tcp/tcp_endpoint_list.go
index 32ac43dca..62c042aff 100755
--- a/pkg/tcpip/transport/tcp/tcp_endpoint_list.go
+++ b/pkg/tcpip/transport/tcp/tcp_endpoint_list.go
@@ -135,8 +135,9 @@ func (l *endpointList) InsertBefore(a, e *endpoint) {
// Remove removes e from l.
func (l *endpointList) Remove(e *endpoint) {
- prev := endpointElementMapper{}.linkerFor(e).Prev()
- next := endpointElementMapper{}.linkerFor(e).Next()
+ linker := endpointElementMapper{}.linkerFor(e)
+ prev := linker.Prev()
+ next := linker.Next()
if prev != nil {
endpointElementMapper{}.linkerFor(prev).SetNext(next)
@@ -149,6 +150,9 @@ func (l *endpointList) Remove(e *endpoint) {
} else {
l.tail = prev
}
+
+ linker.SetNext(nil)
+ linker.SetPrev(nil)
}
// Entry is a default implementation of Linker. Users can add anonymous fields
diff --git a/pkg/tcpip/transport/tcp/tcp_segment_list.go b/pkg/tcpip/transport/tcp/tcp_segment_list.go
index 9b21b87ad..27f17f037 100755
--- a/pkg/tcpip/transport/tcp/tcp_segment_list.go
+++ b/pkg/tcpip/transport/tcp/tcp_segment_list.go
@@ -135,8 +135,9 @@ func (l *segmentList) InsertBefore(a, e *segment) {
// Remove removes e from l.
func (l *segmentList) Remove(e *segment) {
- prev := segmentElementMapper{}.linkerFor(e).Prev()
- next := segmentElementMapper{}.linkerFor(e).Next()
+ linker := segmentElementMapper{}.linkerFor(e)
+ prev := linker.Prev()
+ next := linker.Next()
if prev != nil {
segmentElementMapper{}.linkerFor(prev).SetNext(next)
@@ -149,6 +150,9 @@ func (l *segmentList) Remove(e *segment) {
} else {
l.tail = prev
}
+
+ linker.SetNext(nil)
+ linker.SetPrev(nil)
}
// Entry is a default implementation of Linker. Users can add anonymous fields
diff --git a/pkg/tcpip/transport/udp/udp_packet_list.go b/pkg/tcpip/transport/udp/udp_packet_list.go
index 00535d242..2ae846eaa 100755
--- a/pkg/tcpip/transport/udp/udp_packet_list.go
+++ b/pkg/tcpip/transport/udp/udp_packet_list.go
@@ -135,8 +135,9 @@ func (l *udpPacketList) InsertBefore(a, e *udpPacket) {
// Remove removes e from l.
func (l *udpPacketList) Remove(e *udpPacket) {
- prev := udpPacketElementMapper{}.linkerFor(e).Prev()
- next := udpPacketElementMapper{}.linkerFor(e).Next()
+ linker := udpPacketElementMapper{}.linkerFor(e)
+ prev := linker.Prev()
+ next := linker.Next()
if prev != nil {
udpPacketElementMapper{}.linkerFor(prev).SetNext(next)
@@ -149,6 +150,9 @@ func (l *udpPacketList) Remove(e *udpPacket) {
} else {
l.tail = prev
}
+
+ linker.SetNext(nil)
+ linker.SetPrev(nil)
}
// Entry is a default implementation of Linker. Users can add anonymous fields
diff --git a/pkg/waiter/waiter_list.go b/pkg/waiter/waiter_list.go
index 02fdb730d..07950faa4 100755
--- a/pkg/waiter/waiter_list.go
+++ b/pkg/waiter/waiter_list.go
@@ -135,8 +135,9 @@ func (l *waiterList) InsertBefore(a, e *Entry) {
// Remove removes e from l.
func (l *waiterList) Remove(e *Entry) {
- prev := waiterElementMapper{}.linkerFor(e).Prev()
- next := waiterElementMapper{}.linkerFor(e).Next()
+ linker := waiterElementMapper{}.linkerFor(e)
+ prev := linker.Prev()
+ next := linker.Next()
if prev != nil {
waiterElementMapper{}.linkerFor(prev).SetNext(next)
@@ -149,6 +150,9 @@ func (l *waiterList) Remove(e *Entry) {
} else {
l.tail = prev
}
+
+ linker.SetNext(nil)
+ linker.SetPrev(nil)
}
// Entry is a default implementation of Linker. Users can add anonymous fields