summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/kernel/epoll
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/sentry/kernel/epoll
parent57eb9dd84e0153bb1848c0246d86ef23d116d9a2 (diff)
parent6fa5cee82c0f515b001dee5f3840e1f875b2f477 (diff)
Merge release-20200219.0-122-g6fa5cee (automated)
Diffstat (limited to 'pkg/sentry/kernel/epoll')
-rwxr-xr-xpkg/sentry/kernel/epoll/epoll_list.go8
-rw-r--r--pkg/sentry/kernel/epoll/epoll_state.go13
2 files changed, 14 insertions, 7 deletions
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)
}
}