Received: by 2002:a25:b323:0:0:0:0:0 with SMTP id l35csp355776ybj; Thu, 19 Sep 2019 15:38:19 -0700 (PDT) X-Google-Smtp-Source: APXvYqz14OaKybXFPH1mSHmfB2Zk4W+DvHavqeJBDy3Gax2lV+ayYRVbb4jNCiwAjTS1xolbS+KF X-Received: by 2002:a50:d758:: with SMTP id i24mr18535939edj.246.1568932699172; Thu, 19 Sep 2019 15:38:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568932699; cv=none; d=google.com; s=arc-20160816; b=tBRKApfKBGURViqlrVi8m5zCYeOYJSOdkBO142esWcqW7GHByzkCs56jAIPZhoAH59 R7OZHGDNiok74QYLYhnuUi95H+EzSCR3JSKv+Lg1s6qNXu6o4TkyMJjvT8eDIbml8BzT lwzYzhFby3kCuPXxiBTskClh3zI5fE9YaUgls8AEAvxS9zQrHT1sIR7bf3n1XPEgn9yY LsQzKYJ3kIKkgVqEibCCttOZxnLh7fV5XFSl96bXfzqWjgEJBGjEfcO9sob0MH37xjvd 5xM0oWGT+NU3uTyfpdkoWyCKjsj7+v4nrhg9ylPGp3lVkfEdXWUXWhWpE8wJG60Dl8ki XmYw== 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=LIzTLw1RqR/l+8dS5+AR0FuztdbB7MVF12PoySwlLHc=; b=iDkmv/pixGAEmNHovewRNEAhIHIISPSRlK569emIVEZcdM5pie1onVNnlKjoB8+YC2 teVBIjxEqrYCsdZz45ZD+rxkIhl52EdsF4mb0X0d/qYEphxpiyxkijffBjqaBy8YbpKJ skfnoOjChOM+dZOmkZVtCOMgOf0Yg6XUczNMs/LvXHfiN00IogLQ4QnfB5ta270IYz7N Ufhg0QnQSvr8Ez47zTkLEBNOHsYuFtU8DIp04zfkhzSxq8YCVg/gNoa2oHKtDyy7gCF1 XRQkHXUahmw0LLg+L5yVz8G6xck+GVzHHoSWZuQMxRuEsj7oDcosZqNgPxTf25/IdJX7 2Gmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=2L3Ei2iV; 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 c26si87838edx.353.2019.09.19.15.37.55; Thu, 19 Sep 2019 15:38:19 -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=2L3Ei2iV; 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 S2392331AbfISWS1 (ORCPT + 99 others); Thu, 19 Sep 2019 18:18:27 -0400 Received: from mail.kernel.org ([198.145.29.99]:59854 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2393910AbfISWSW (ORCPT ); Thu, 19 Sep 2019 18:18:22 -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 D805821A49; Thu, 19 Sep 2019 22:18:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1568931501; bh=4XeXMAQl36BSINDqn9rleIQYysRKYqrRW9jUf+jNRkc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2L3Ei2iVLvoYz2b484peupAsIaToC7XPTNaJyWZ6fqORKMxoy0XrDpTv4S12uqRyC NLTV+AUWgsOxA4OB79+5j9jZ7oiUx0euYvj7oCsaHKj3eoqEl7Z/pJ1tUWLSnmTRC3 clNAl1is25g7nyj37NW1lp5IEtUGtmlsuj8peSQ0= 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 4.9 10/74] tcp: fix tcp_ecn_withdraw_cwr() to clear TCP_ECN_QUEUE_CWR Date: Fri, 20 Sep 2019 00:03:23 +0200 Message-Id: <20190919214804.728838256@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190919214800.519074117@linuxfoundation.org> References: <20190919214800.519074117@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 @@ -247,7 +247,7 @@ static void tcp_ecn_accept_cwr(struct tc 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)