public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH 1/2] MdeModulePkg/Tcp4Dxe: Fix unconditional window shrinking
@ 2017-03-28  7:20 atepin
  2017-03-28  7:20 ` [PATCH 2/2] NetworkPkg/TcpDxe: " atepin
  2017-03-29  6:56 ` [PATCH 1/2] MdeModulePkg/Tcp4Dxe: " Tian, Feng
  0 siblings, 2 replies; 16+ messages in thread
From: atepin @ 2017-03-28  7:20 UTC (permalink / raw)
  To: edk2-devel@lists.01.org

Moving Right window edge to the left on sender side without additional
checks leads to the situation when sender assumes the receiver shrunk
its rcv buffer, when, in fact, it only reduced window size. This is a
TCP deadlock situation. Receiver ACKs proper segment, while sender
discards it for future ACK. Add check for negative usable window to
prevent erroneous window shrinking.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Andrey Tepin <atepin@kraftway.ru>
---
 MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Input.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Input.c b/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Input.c
index 1000538..ea0766a 100644
--- a/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Input.c
+++ b/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Input.c
@@ -703,6 +703,7 @@ TcpInput (
   TCP_SEG     *Seg;
   TCP_SEQNO   Right;
   TCP_SEQNO   Urg;
+  INT32       UsableWnd;
 
   NET_CHECK_SIGNATURE (Nbuf, NET_BUF_SIGNATURE);
 
@@ -1188,7 +1189,10 @@ TcpInput (
 
       if (TCP_SEQ_LT (Right, Tcb->SndNxt)) {
 
-        Tcb->SndNxt = Right;
+        UsableWnd = Tcb->SndUna + Tcb->SndWnd - Tcb->SndNxt;
+        if (UsableWnd < 0) {
+          Tcb->SndNxt = Right;
+        }
 
         if (Right == Tcb->SndUna) {
 
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2017-04-18  9:57 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-28  7:20 [PATCH 1/2] MdeModulePkg/Tcp4Dxe: Fix unconditional window shrinking atepin
2017-03-28  7:20 ` [PATCH 2/2] NetworkPkg/TcpDxe: " atepin
2017-04-05  9:47   ` Fu, Siyuan
2017-04-06 15:34     ` atepin
2017-04-12 10:48       ` Fu, Siyuan
2017-04-13 14:33         ` atepin
2017-04-14  1:03           ` Fu, Siyuan
2017-04-14  9:00           ` Fu, Siyuan
2017-04-14 13:31             ` atepin
2017-04-17  2:41               ` Fu, Siyuan
2017-04-17 14:40                 ` atepin
2017-04-18  3:55                   ` Fu, Siyuan
2017-04-18  8:06                     ` atepin
2017-04-18  8:46                       ` Fu, Siyuan
2017-04-18  9:57                         ` atepin
2017-03-29  6:56 ` [PATCH 1/2] MdeModulePkg/Tcp4Dxe: " Tian, Feng

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox