tcpip/link/veth: don't send any packets if another end has been closed

Reported-by: syzbot+077cb394a25e5bfa4ed9@syzkaller.appspotmail.com
PiperOrigin-RevId: 650316007
This commit is contained in:
Andrei Vagin
2024-07-08 11:27:23 -07:00
committed by gVisor bot
parent 704e3289d3
commit 9d1849029e
+7
View File
@@ -197,6 +197,13 @@ func (e *Endpoint) SetLinkAddress(addr tcpip.LinkAddress) {
// WritePackets stores outbound packets into the channel.
// Multiple concurrent calls are permitted.
func (e *Endpoint) WritePackets(pkts stack.PacketBufferList) (int, tcpip.Error) {
e.veth.mu.RLock()
defer e.veth.mu.RUnlock()
if e.veth.closed {
return 0, nil
}
n := 0
for _, pkt := range pkts.AsSlice() {
// In order to properly loop back to the inbound side we must create a