Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/1376793/?format=api
{ "id": 1376793, "url": "http://patchwork.ozlabs.org/api/patches/1376793/?format=api", "web_url": "http://patchwork.ozlabs.org/project/netdev/patch/20201005134813.2051883-1-eric.dumazet@gmail.com/", "project": { "id": 7, "url": "http://patchwork.ozlabs.org/api/projects/7/?format=api", "name": "Linux network development", "link_name": "netdev", "list_id": "netdev.vger.kernel.org", "list_email": "netdev@vger.kernel.org", "web_url": null, "scm_url": null, "webscm_url": null, "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20201005134813.2051883-1-eric.dumazet@gmail.com>", "list_archive_url": null, "date": "2020-10-05T13:48:13", "name": "[net] tcp: fix receive window update in tcp_add_backlog()", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "f5df782865cfa2174f7ef3c8f6dcc2c4e0123d5b", "submitter": { "id": 2404, "url": "http://patchwork.ozlabs.org/api/people/2404/?format=api", "name": "Eric Dumazet", "email": "eric.dumazet@gmail.com" }, "delegate": { "id": 34, "url": "http://patchwork.ozlabs.org/api/users/34/?format=api", "username": "davem", "first_name": "David", "last_name": "Miller", "email": "davem@davemloft.net" }, "mbox": "http://patchwork.ozlabs.org/project/netdev/patch/20201005134813.2051883-1-eric.dumazet@gmail.com/mbox/", "series": [ { "id": 206027, "url": "http://patchwork.ozlabs.org/api/series/206027/?format=api", "web_url": "http://patchwork.ozlabs.org/project/netdev/list/?series=206027", "date": "2020-10-05T13:48:13", "name": "[net] tcp: fix receive window update in tcp_add_backlog()", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/206027/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/1376793/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/1376793/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<netdev-owner@vger.kernel.org>", "X-Original-To": "patchwork-incoming-netdev@ozlabs.org", "Delivered-To": "patchwork-incoming-netdev@ozlabs.org", "Authentication-Results": [ "ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=23.128.96.18; helo=vger.kernel.org;\n envelope-from=netdev-owner@vger.kernel.org; receiver=<UNKNOWN>)", "ozlabs.org;\n dmarc=pass (p=none dis=none) header.from=gmail.com", "ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256\n header.s=20161025 header.b=KIftgAPH;\n\tdkim-atps=neutral" ], "Received": [ "from vger.kernel.org (vger.kernel.org [23.128.96.18])\n\tby ozlabs.org (Postfix) with ESMTP id 4C4hkt4zjtz9sTR\n\tfor <patchwork-incoming-netdev@ozlabs.org>;\n Tue, 6 Oct 2020 00:48:22 +1100 (AEDT)", "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n id S1725974AbgJENsU (ORCPT\n <rfc822;patchwork-incoming-netdev@ozlabs.org>);\n Mon, 5 Oct 2020 09:48:20 -0400", "from lindbergh.monkeyblade.net ([23.128.96.19]:33012 \"EHLO\n lindbergh.monkeyblade.net\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n with ESMTP id S1725932AbgJENsT (ORCPT\n <rfc822;netdev@vger.kernel.org>); Mon, 5 Oct 2020 09:48:19 -0400", "from mail-pj1-x1042.google.com (mail-pj1-x1042.google.com\n [IPv6:2607:f8b0:4864:20::1042])\n by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3E082C0613CE\n for <netdev@vger.kernel.org>; Mon, 5 Oct 2020 06:48:18 -0700 (PDT)", "by mail-pj1-x1042.google.com with SMTP id i3so5640519pjz.4\n for <netdev@vger.kernel.org>; Mon, 05 Oct 2020 06:48:18 -0700 (PDT)", "from edumazet1.svl.corp.google.com\n ([2620:15c:2c4:201:7220:84ff:fe09:1424])\n by smtp.gmail.com with ESMTPSA id\n e16sm11131893pgv.81.2020.10.05.06.48.16\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Mon, 05 Oct 2020 06:48:16 -0700 (PDT)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=gmail.com; s=20161025;\n h=from:to:cc:subject:date:message-id:mime-version\n :content-transfer-encoding;\n bh=AbMWngrDLVZ2m1L7tSwCryLRvupGsFR9BCcIm1c6i0k=;\n b=KIftgAPHZxvCg7VEYbJOpVLO8UR+DT0zWHpj+xgIRdse/r0kE0LzGSL568ULx69oYy\n ke05vnfsiBs9WuvZ9rbjoHpOe+XZpoFv5ffJDsBA394z5b84y6pg9kqCRKsjHO+rd92a\n t6Sp9n64KD22XJe9+opgzZRYOPlhWMzMoGG7k97Q/7ovoVAFGh6HWzEZ1MbODtUL7li+\n 5pFJP8IAGetK9lKjFxFaft88YHti7cqlIvHkCXzuDCq+hlif/tZC4V1CpPstMZpVcq0W\n DlIKORS1Th7ckp9FNW8CTL7my8kbyTDO/bCkBYSNe0TTf5yrhZU4TVx9tZ2zs3/o0h8X\n QZNA==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20161025;\n h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version\n :content-transfer-encoding;\n bh=AbMWngrDLVZ2m1L7tSwCryLRvupGsFR9BCcIm1c6i0k=;\n b=JWvaLiwZo78wgmhJonnMNoh3bfTb7yRLj0+6jn9g67FkAJDukIoZ8dfXyGwFBIWhe4\n GudRHdjajs03TMUX+wJ4q0Z57EyR1/DeSTk3PiJs7WOgMh8tSG3W5+tPRaiRMDNiDTRA\n 36brW8rhTARDTWAshvU+27gZAHeWQvs2qJiBuZ1k7SFfVk9ip5AeFLemMthUGgkIYK2D\n 5BV3BGrap7KzMsSLFxHLZCfnkhIj0EJqnhPIOF0/m3evy6jDOOytqIdw75gsEJZoTNcX\n uyPVV3SVbtzzlEFYCqrrkqEOqiqpw7K16WNYeccwoPRzHgIzYpekQQC/j74mzStybmzQ\n 5dJg==", "X-Gm-Message-State": "AOAM531ds4dWRC9+kOHBTe9HHaH9zEeQcmfLMhzR5YBPvDozEr6GkLHi\n YmiqsW2CRtQbV+Ji/66ZjWU=", "X-Google-Smtp-Source": "\n ABdhPJxwl0Fkm/jDgIPkQ3FDbjpdI960T07aaJzBu0mIfsHR5fFXloWGdJSYPabA8XAiaHstbZhMBg==", "X-Received": "by 2002:a17:90a:5c83:: with SMTP id\n r3mr17200718pji.112.1601905697556;\n Mon, 05 Oct 2020 06:48:17 -0700 (PDT)", "From": "Eric Dumazet <eric.dumazet@gmail.com>", "To": "\"David S . Miller\" <davem@davemloft.net>", "Cc": "netdev <netdev@vger.kernel.org>,\n Soheil Hassas Yeganeh <soheil@google.com>,\n Neal Cardwell <ncardwell@google.com>,\n Yuchung Cheng <ycheng@google.com>,\n Eric Dumazet <edumazet@google.com>,\n Eric Dumazet <eric.dumazet@gmail.com>,\n Alexandre Ferrieux <alexandre.ferrieux@orange.com>", "Subject": "[PATCH net] tcp: fix receive window update in tcp_add_backlog()", "Date": "Mon, 5 Oct 2020 06:48:13 -0700", "Message-Id": "<20201005134813.2051883-1-eric.dumazet@gmail.com>", "X-Mailer": "git-send-email 2.28.0.806.g8561365e88-goog", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Precedence": "bulk", "List-ID": "<netdev.vger.kernel.org>", "X-Mailing-List": "netdev@vger.kernel.org" }, "content": "From: Eric Dumazet <edumazet@google.com>\n\nWe got reports from GKE customers flows being reset by netfilter\nconntrack unless nf_conntrack_tcp_be_liberal is set to 1.\n\nTraces seemed to suggest ACK packet being dropped by the\npacket capture, or more likely that ACK were received in the\nwrong order.\n\n wscale=7, SYN and SYNACK not shown here.\n\n This ACK allows the sender to send 1871*128 bytes from seq 51359321 :\n New right edge of the window -> 51359321+1871*128=51598809\n\n 09:17:23.389210 IP A > B: Flags [.], ack 51359321, win 1871, options [nop,nop,TS val 10 ecr 999], length 0\n\n 09:17:23.389212 IP B > A: Flags [.], seq 51422681:51424089, ack 1577, win 268, options [nop,nop,TS val 999 ecr 10], length 1408\n 09:17:23.389214 IP A > B: Flags [.], ack 51422681, win 1376, options [nop,nop,TS val 10 ecr 999], length 0\n 09:17:23.389253 IP B > A: Flags [.], seq 51424089:51488857, ack 1577, win 268, options [nop,nop,TS val 999 ecr 10], length 64768\n 09:17:23.389272 IP A > B: Flags [.], ack 51488857, win 859, options [nop,nop,TS val 10 ecr 999], length 0\n 09:17:23.389275 IP B > A: Flags [.], seq 51488857:51521241, ack 1577, win 268, options [nop,nop,TS val 999 ecr 10], length 32384\n\n Receiver now allows to send 606*128=77568 from seq 51521241 :\n New right edge of the window -> 51521241+606*128=51598809\n\n 09:17:23.389296 IP A > B: Flags [.], ack 51521241, win 606, options [nop,nop,TS val 10 ecr 999], length 0\n\n 09:17:23.389308 IP B > A: Flags [.], seq 51521241:51553625, ack 1577, win 268, options [nop,nop,TS val 999 ecr 10], length 32384\n\n It seems the sender exceeds RWIN allowance, since 51611353 > 51598809\n\n 09:17:23.389346 IP B > A: Flags [.], seq 51553625:51611353, ack 1577, win 268, options [nop,nop,TS val 999 ecr 10], length 57728\n 09:17:23.389356 IP B > A: Flags [.], seq 51611353:51618393, ack 1577, win 268, options [nop,nop,TS val 999 ecr 10], length 7040\n\n 09:17:23.389367 IP A > B: Flags [.], ack 51611353, win 0, options [nop,nop,TS val 10 ecr 999], length 0\n\n netfilter conntrack is not happy and sends RST\n\n 09:17:23.389389 IP A > B: Flags [R], seq 92176528, win 0, length 0\n 09:17:23.389488 IP B > A: Flags [R], seq 174478967, win 0, length 0\n\n Now imagine ACK were delivered out of order and tcp_add_backlog() sets window based on wrong packet.\n New right edge of the window -> 51521241+859*128=51631193\n\nNormally TCP stack handles OOO packets just fine, but it\nturns out tcp_add_backlog() does not. It can update the window\nfield of the aggregated packet even if the ACK sequence\nof the last received packet is too old.\n\nMany thanks to Alexandre Ferrieux for independently reporting the issue\nand suggesting a fix.\n\nFixes: 4f693b55c3d2 (\"tcp: implement coalescing on backlog queue\")\nSigned-off-by: Eric Dumazet <edumazet@google.com>\nReported-by: Alexandre Ferrieux <alexandre.ferrieux@orange.com>\n---\n net/ipv4/tcp_ipv4.c | 6 +++---\n 1 file changed, 3 insertions(+), 3 deletions(-)", "diff": "diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c\nindex 5084333b5ab647ca8ed296235a1ed6573693b250..592c7396272315c864372c158a7bc8850c6ddc61 100644\n--- a/net/ipv4/tcp_ipv4.c\n+++ b/net/ipv4/tcp_ipv4.c\n@@ -1788,12 +1788,12 @@ bool tcp_add_backlog(struct sock *sk, struct sk_buff *skb)\n \n \t__skb_pull(skb, hdrlen);\n \tif (skb_try_coalesce(tail, skb, &fragstolen, &delta)) {\n-\t\tthtail->window = th->window;\n-\n \t\tTCP_SKB_CB(tail)->end_seq = TCP_SKB_CB(skb)->end_seq;\n \n-\t\tif (after(TCP_SKB_CB(skb)->ack_seq, TCP_SKB_CB(tail)->ack_seq))\n+\t\tif (likely(!before(TCP_SKB_CB(skb)->ack_seq, TCP_SKB_CB(tail)->ack_seq))) {\n \t\t\tTCP_SKB_CB(tail)->ack_seq = TCP_SKB_CB(skb)->ack_seq;\n+\t\t\tthtail->window = th->window;\n+\t\t}\n \n \t\t/* We have to update both TCP_SKB_CB(tail)->tcp_flags and\n \t\t * thtail->fin, so that the fast path in tcp_rcv_established()\n", "prefixes": [ "net" ] }