From d01514263b82c4eb0e2843950714eff8992e22e6 Mon Sep 17 00:00:00 2001 From: Nayana Bidari Date: Thu, 6 Mar 2025 16:33:52 -0800 Subject: [PATCH] Do not process ACKs when endpoint is in error state. PiperOrigin-RevId: 734333026 --- pkg/tcpip/transport/tcp/connect.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/tcpip/transport/tcp/connect.go b/pkg/tcpip/transport/tcp/connect.go index c04def4f4..d31ce112f 100644 --- a/pkg/tcpip/transport/tcp/connect.go +++ b/pkg/tcpip/transport/tcp/connect.go @@ -1317,8 +1317,12 @@ func (e *Endpoint) handleSegmentLocked(s *segment) (cont bool, err tcpip.Error) // Now check if the received segment has caused us to transition // to a CLOSED state, if yes then terminate processing and do // not invoke the sender. + // It is also possible that the sender has sent a RST before + // which got lost and didn't reach the other side. At that time, + // we can still receive ACKs after the sender has purged the + // write list. Do not process such ACKs and return immediately. state := e.EndpointState() - if state == StateClose { + if state == StateClose || state == StateError { // When we get into StateClose while processing from the queue, // return immediately and let the TCP processors handle it. return false, nil