Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1678913pxu; Sun, 6 Dec 2020 03:48:34 -0800 (PST) X-Google-Smtp-Source: ABdhPJyoNWK5cPhEUaplAoWDjdlafBhp7HD7KElsiguCPVqwUk6BfwmeJTFUZ1G6PWHUFtFDvhMR X-Received: by 2002:a50:9dc9:: with SMTP id l9mr552346edk.377.1607255314139; Sun, 06 Dec 2020 03:48:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607255314; cv=none; d=google.com; s=arc-20160816; b=JmLjfSgIGB57yCg34SXYHt9ZBXmnuoMdKcs3sEkPm8hkl6/5KfAJoHcom8ZQP1qzni T5awl3SE3m1C4JZlVnvyfnjvQ0dffr9v9y3RJdOlO4eYbxtrGlhnfXfge4hJ4wh4qunq uMBAJekg1vlz49iLTes4+HQvc+N5spLv0b63fVxtmtvaCtHQn9ii5qA9iqPhHUwCfaxI m0lpzxTPwn5qO0rx5Ryf6YeRpjehSc3t+BzX3JKJ6R7eoNwEqTcVVqt2Oqr9FM3SCe4y wVj29Gcnfzu2Ux7MiU+ZMwx2Miw3LgAsz74hjr4D/7VeqMZ6Acavmt194wsNT60Y/tWh DejQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from; bh=daeAaNmo/8P/GfFrmRle6Uk4p6KfWyAB1EV/VvIy1XU=; b=H3nQDmG5UuhOTYnIaPMX8t8EK/VXaAacnKjo86qiE1YF/lbqjKcPGMNg3VIFlNsU2h ERo2ghNOs+DzKj0ZZjIMZ0ITIz253D3hiDUBCHJepVN2k911I9xE79uvDQ4luLSAmSzy zqsgueoJ+qVgclyD6hVpwgTtr4E6rMzmEBkTYuNNC6eeBCNvuT+NugRqtygsRZ8HuR1F il++3sP6WeOfl1OSIqk3FZw+OFpgWp42XONtaY6WruJ2JjtgeenznyZNmfTZYQJE7Xny IX4B8TuanobAwlio2A8skARTJj/6cZwZBXV08mrpQLmbaSSJvoradcZHDpA63IlhYKoN 56ww== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w17si442483edv.64.2020.12.06.03.48.11; Sun, 06 Dec 2020 03:48:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728900AbgLFLq5 (ORCPT + 99 others); Sun, 6 Dec 2020 06:46:57 -0500 Received: from mail.kernel.org ([198.145.29.99]:44588 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729368AbgLFLoi (ORCPT ); Sun, 6 Dec 2020 06:44:38 -0500 From: Greg Kroah-Hartman Authentication-Results: mail.kernel.org; dkim=permerror (bad message/signature format) To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Morton , Pete Heist , =?UTF-8?q?Toke=20H=C3=B8iland-J=C3=B8rgensen?= , Jakub Kicinski Subject: [PATCH 5.9 23/46] inet_ecn: Fix endianness of checksum update when setting ECT(1) Date: Sun, 6 Dec 2020 12:17:31 +0100 Message-Id: <20201206111557.570807631@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201206111556.455533723@linuxfoundation.org> References: <20201206111556.455533723@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: "Toke H?iland-J?rgensen" [ Upstream commit 2867e1eac61016f59b3d730e3f7aa488e186e917 ] When adding support for propagating ECT(1) marking in IP headers it seems I suffered from endianness-confusion in the checksum update calculation: In fact the ECN field is in the *lower* bits of the first 16-bit word of the IP header when calculating in network byte order. This means that the addition performed to update the checksum field was wrong; let's fix that. Fixes: b723748750ec ("tunnel: Propagate ECT(1) when decapsulating as recommended by RFC6040") Reported-by: Jonathan Morton Tested-by: Pete Heist Signed-off-by: Toke Høiland-Jørgensen Link: https://lore.kernel.org/r/20201130183705.17540-1-toke@redhat.com Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- include/net/inet_ecn.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/include/net/inet_ecn.h +++ b/include/net/inet_ecn.h @@ -107,7 +107,7 @@ static inline int IP_ECN_set_ect1(struct if ((iph->tos & INET_ECN_MASK) != INET_ECN_ECT_0) return 0; - check += (__force u16)htons(0x100); + check += (__force u16)htons(0x1); iph->check = (__force __sum16)(check + (check>=0xFFFF)); iph->tos ^= INET_ECN_MASK;