Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3971771pxb; Tue, 25 Jan 2022 00:19:13 -0800 (PST) X-Google-Smtp-Source: ABdhPJypAMpLL4xBN46L6SXhHiMkVNhJj+k+kSIA7BhDTDA3h1I9LAXq+2ua5oz07NIHbaiv+W4E X-Received: by 2002:a05:6402:42d0:: with SMTP id i16mr19497865edc.143.1643098752769; Tue, 25 Jan 2022 00:19:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643098752; cv=none; d=google.com; s=arc-20160816; b=p/TDKHqxQtkUA7cA15r/l5Zeqp1O9ToqL4Ee9SYocsYkrewgwGUmY9TzSgq8dQW+7E EX0tx1q0SKYuRHLlM7vwB5AGVXtz/GNwof7fhz/auYTewD+oWJdyXtOQwp/3t+azoDC4 PC1p8Kstksjovt9GfLd41r07CgpWIAVt2yjVBpu6VtTFvZUcKP3GgBOmOuFOIcOxDldS cQsB5BpgWm2DUvMup01s4x+z+7WhEhVJhYABqZKvjLKa2UgXIUisRf/c3pePVm3q9Jzl XdksKZpDQUPEod9F3Uzrl0NRXapFfFKtvRYAIfPZ7FVnEUY0RE5mHf3vDTk7IFJ0p8f1 xcAg== 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:dkim-signature; bh=54qlVxTIQ0Nzrgsub3GtBhVnt6G5ZSEZ8P3QU3WQ8n8=; b=aiHWiwcCKh5eMHyQCQplA9D1TXFWevECuARSZvm0G5ilFHAWJoxQN+1+Krwxjctp1+ DiOsjnewMkBpsFRen9Ne1xjTkhjKN+FD7fZ/SQYAsazGoWId8KStL3lely2MDGQtljBo vz3d6N2qcr5xTVw2euLdgFB/2r2H/xpn+4EtfFGto7D11K+nWgVM2LlFYPvww5CXrAFK m48O5h/IQyNS5BTQiao+yVMeq4QoCiPiNzGA2LO0cs12Zb2rKb48e3wfpi5Mw+emk9eO 0lpi0D9xPaU0gvChdcpcR2lObkNHjtgBpzY6+G7kVPBWCfbZtmXxmvqqETkzNGck42BU gpjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=oUY0+8Pg; 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=pass (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 n14si10371075edx.94.2022.01.25.00.18.47; Tue, 25 Jan 2022 00:19:12 -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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=oUY0+8Pg; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3412808AbiAYAhv (ORCPT + 99 others); Mon, 24 Jan 2022 19:37:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57814 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2364099AbiAXXqp (ORCPT ); Mon, 24 Jan 2022 18:46:45 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 64E78C07E301; Mon, 24 Jan 2022 13:42:39 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 22CDAB8123A; Mon, 24 Jan 2022 21:42:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 537A4C340E4; Mon, 24 Jan 2022 21:42:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060556; bh=yBgjbG95xYBaKYlqVCGbOh+SNsixA6Cot1PJPTtTCS4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oUY0+8PgwjAMifumK/gJ+VS1YUOXWfN3STbfsXAHdVrEzUS6PX+t7CuFZ0AsHjBlT RHwulWYVmDeM/JhAE/oOZqWJM9olfPVza6TB+5D3IxYqbO1x5mgLLxEITHNLiLN+++ iF7RStvTsMEzxBp4si7y80QYPMRryFi2KO4XSwUU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Guillaume Nault , Jakub Kicinski Subject: [PATCH 5.16 0988/1039] xfrm: Dont accidentally set RTO_ONLINK in decode_session4() Date: Mon, 24 Jan 2022 19:46:17 +0100 Message-Id: <20220124184158.486374487@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@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: Guillaume Nault commit 23e7b1bfed61e301853b5e35472820d919498278 upstream. Similar to commit 94e2238969e8 ("xfrm4: strip ECN bits from tos field"), clear the ECN bits from iph->tos when setting ->flowi4_tos. This ensures that the last bit of ->flowi4_tos is cleared, so ip_route_output_key_hash() isn't going to restrict the scope of the route lookup. Use ~INET_ECN_MASK instead of IPTOS_RT_MASK, because we have no reason to clear the high order bits. Found by code inspection, compile tested only. Fixes: 4da3089f2b58 ("[IPSEC]: Use TOS when doing tunnel lookups") Signed-off-by: Guillaume Nault Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- net/xfrm/xfrm_policy.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/net/xfrm/xfrm_policy.c +++ b/net/xfrm/xfrm_policy.c @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include @@ -3295,7 +3296,7 @@ decode_session4(struct sk_buff *skb, str fl4->flowi4_proto = iph->protocol; fl4->daddr = reverse ? iph->saddr : iph->daddr; fl4->saddr = reverse ? iph->daddr : iph->saddr; - fl4->flowi4_tos = iph->tos; + fl4->flowi4_tos = iph->tos & ~INET_ECN_MASK; if (!ip_is_fragment(iph)) { switch (iph->protocol) {