mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
netstack: clear buckets upon close
It was possible for `close` and `dispatch` to race, each trying to `DecRef` the same packet. We now clear the bucket of packets upon `close` so that `DecRef` occurs only once. PiperOrigin-RevId: 540663408
This commit is contained in:
committed by
gVisor bot
parent
90bf8f22fc
commit
12f6b63c31
@@ -678,8 +678,9 @@ func (gd *groDispatcher) close() {
|
||||
for i := range gd.buckets {
|
||||
bucket := &gd.buckets[i]
|
||||
bucket.mu.Lock()
|
||||
for groPkt := bucket.packets.Front(); groPkt != nil; groPkt = groPkt.Next() {
|
||||
for groPkt := bucket.packets.Front(); groPkt != nil; groPkt = bucket.packets.Front() {
|
||||
groPkt.pkt.DecRef()
|
||||
bucket.removeOne(groPkt)
|
||||
}
|
||||
bucket.mu.Unlock()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user