Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp6237690ybe; Tue, 17 Sep 2019 23:33:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqyUGlfiSjvLN+Fv7cTAxvhdS/IDWG79s4Arhlp18MKpRMoS1KOPcYbOcB5i3PVSgMPnGATF X-Received: by 2002:a50:91b1:: with SMTP id g46mr1539439eda.255.1568788432076; Tue, 17 Sep 2019 23:33:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568788432; cv=none; d=google.com; s=arc-20160816; b=UvrJQgBnGOoKcaBdXv0nnk2bTiOlcQCszI88sIf2UlTHOC3EqCxYm1bp0wOLvJhFj0 b8SJ89EcwlFtdpTzNHH3N6ZsR3fu2zQadhOalAkFJpqa50Z9E/TqqaMfW66Xghmx5Dxz zMtF5FGE/b85nzyLq/irqwYcs18O3sxeeeS5jDfkGr6VE4tZQ12b7sx22TPmbIM1FyVJ gEo4fvxn1dkQJLp55duGExF4OlUwo1LrNo3H/IgIf09/ZkdfUN9cSB4vakR1R+45Iml/ gu0fp4Ac5aFOrt9u1rCFG+8Cxkl7V2gIK+r4L5kY/Id/qx9yDLXzZskjyGH0bz5++L8a SrPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=fxcRX2MCl6HLkgCYlZZJKjQUfFkUD+8p638RTgTnowU=; b=BMglw7fRw2KXLmKrLfWTsQ6SL7DAfGpUhll//sSJAaAYNqSMAIEwQGpaZre4bJ4/8j ozC7ShE6yKr/nC0XXBaIjjQiGeUgxDI6LafiaqzJ1j+gd8BPP+hrRvvHC0YCaQYokrl9 DDpdI8/2dzj2yTmo8tik9Gk8YkuzbLBLO+pjdp0kVVdhE7D5lhkdcNBme0IxD+Qb/RYm iR4cPsPpfS+1kdHSTapZLEUpa+ZbAmf/sxtJpG7m89oOhRMecWzyL6c50FDW4SmuLHrY 19e9skcM5kbpiFYXKjgDf8OZFaoQMY7JMS9wvDc5LRlO8kcXKs4i/x6HWaiwkMg+XR9/ LRjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=SF5tD3Jg; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g4si2596008edr.377.2019.09.17.23.33.29; Tue, 17 Sep 2019 23:33:52 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=SF5tD3Jg; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729883AbfIRGae (ORCPT + 99 others); Wed, 18 Sep 2019 02:30:34 -0400 Received: from mail.kernel.org ([198.145.29.99]:45028 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728763AbfIRGYa (ORCPT ); Wed, 18 Sep 2019 02:24:30 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B9CEA218AF; Wed, 18 Sep 2019 06:24:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1568787869; bh=wN84EXygS75F4cZ+gLTyyU/BKie991M2OnFOKEEZc+4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SF5tD3JgYeGDetwVxrmtVreh9iVgpXuTwAJjOFgLeEvmeoItp5ldq7HOVJ4LjEEAm bFUHlIc4UojP8RD91BDgSJtEu32NcTCnCA52858vtbKSMW6mjruF285jbWduRSf3qT nz1I2/C3a3IaAWS9HDrpUpN/ja3vQK1dk9SyKMRQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Neal Cardwell , Yuchung Cheng , Soheil Hassas Yeganeh , Eric Dumazet , "David S. Miller" Subject: [PATCH 5.2 14/85] tcp: fix tcp_ecn_withdraw_cwr() to clear TCP_ECN_QUEUE_CWR Date: Wed, 18 Sep 2019 08:18:32 +0200 Message-Id: <20190918061234.593793994@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190918061234.107708857@linuxfoundation.org> References: <20190918061234.107708857@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Neal Cardwell [ Upstream commit af38d07ed391b21f7405fa1f936ca9686787d6d2 ] Fix tcp_ecn_withdraw_cwr() to clear the correct bit: TCP_ECN_QUEUE_CWR. Rationale: basically, TCP_ECN_DEMAND_CWR is a bit that is purely about the behavior of data receivers, and deciding whether to reflect incoming IP ECN CE marks as outgoing TCP th->ece marks. The TCP_ECN_QUEUE_CWR bit is purely about the behavior of data senders, and deciding whether to send CWR. The tcp_ecn_withdraw_cwr() function is only called from tcp_undo_cwnd_reduction() by data senders during an undo, so it should zero the sender-side state, TCP_ECN_QUEUE_CWR. It does not make sense to stop the reflection of incoming CE bits on incoming data packets just because outgoing packets were spuriously retransmitted. The bug has been reproduced with packetdrill to manifest in a scenario with RFC3168 ECN, with an incoming data packet with CE bit set and carrying a TCP timestamp value that causes cwnd undo. Before this fix, the IP CE bit was ignored and not reflected in the TCP ECE header bit, and sender sent a TCP CWR ('W') bit on the next outgoing data packet, even though the cwnd reduction had been undone. After this fix, the sender properly reflects the CE bit and does not set the W bit. Note: the bug actually predates 2005 git history; this Fixes footer is chosen to be the oldest SHA1 I have tested (from Sep 2007) for which the patch applies cleanly (since before this commit the code was in a .h file). Fixes: bdf1ee5d3bd3 ("[TCP]: Move code from tcp_ecn.h to tcp*.c and tcp.h & remove it") Signed-off-by: Neal Cardwell Acked-by: Yuchung Cheng Acked-by: Soheil Hassas Yeganeh Cc: Eric Dumazet Signed-off-by: Eric Dumazet Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/ipv4/tcp_input.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c @@ -266,7 +266,7 @@ static void tcp_ecn_accept_cwr(struct so static void tcp_ecn_withdraw_cwr(struct tcp_sock *tp) { - tp->ecn_flags &= ~TCP_ECN_DEMAND_CWR; + tp->ecn_flags &= ~TCP_ECN_QUEUE_CWR; } static void __tcp_ecn_check_ce(struct sock *sk, const struct sk_buff *skb)