Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1678444pxu; Sun, 6 Dec 2020 03:47:18 -0800 (PST) X-Google-Smtp-Source: ABdhPJwExtMTpvnd5VJesu1YH4yweiGZQ2vJOVmd4VTpj6mwKrDuwrRtQNhardaFOIkoJd+2v0kz X-Received: by 2002:a17:906:b292:: with SMTP id q18mr14985386ejz.93.1607255238160; Sun, 06 Dec 2020 03:47:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607255238; cv=none; d=google.com; s=arc-20160816; b=BM7bl+2txCmIodFROtw8EGwBLHMzGsvEvZAU5dJmCrKtNzZXv0H9o511dUMe8zSah+ gR6dz5I/AUP43XdC7LZWDkPv/krd5x+q3M2mLefC+vxlEurZ2Ly2XPWMiPFdv9Iwro+N lXOz0qo7MfWj0pX/CinbLZhZKmC1tR3ybKRa4lYekVsp6DYSFJjcQn6D6xilSadl3ugK WEj9kKve74Jvm+ulNB90A0Ziy3SZ/oQUJEyYoVXZtrqijobeM9nRfosMkgrBroTzppNp SGFf5IyfZ48uqyd8tZqqsNr2RIFp6JBwG++EQvSUCvscdhKSkHe2yul0DiZB6aRGhIry Y3ig== 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=dJXCbMfymcdk0Bc+8ADTJhjh6p6oiZNMW54AhJ7B+Q+bcheRQPS0SCnWMVCopobX3z ara5ncIjMCRrjcugS56Fd2PJYmgs4Zj9OQnn9ACqVgUwnP04ruFqdyuWBo1FD5eIZj3n TbhzTgt1MkEWUHIdBqAQowcy1VWCoZJIYOF2W9CY4nSSk+zsHIrSujnxJfdlCPQLIFyR 6Se6MTNKajqeGNxk4CwTRMwROvC3/IxSwRp9+fulG3cD6e1kII4RIU3nO+eSNeOj8yhM WJihkg715ph2OStlX7WZ9BcDxTXIHO/KhFDeo0tUTIaLQmqzYfg/307gKmm9kRZ1ljQW GwSA== 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 x72si6377652ede.132.2020.12.06.03.46.55; Sun, 06 Dec 2020 03:47:18 -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 S1727868AbgLFLmv (ORCPT + 99 others); Sun, 6 Dec 2020 06:42:51 -0500 Received: from mail.kernel.org ([198.145.29.99]:41788 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727918AbgLFLmp (ORCPT ); Sun, 6 Dec 2020 06:42:45 -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.4 21/39] inet_ecn: Fix endianness of checksum update when setting ECT(1) Date: Sun, 6 Dec 2020 12:17:25 +0100 Message-Id: <20201206111555.693217763@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201206111554.677764505@linuxfoundation.org> References: <20201206111554.677764505@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;