Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp4396622pxb; Mon, 21 Feb 2022 20:13:11 -0800 (PST) X-Google-Smtp-Source: ABdhPJxvdD6BUcC368AUzWj00ywccGI8I357OfnScTRwD1Ms7pP/0AqFQfD2TUY71lRY6OwJ1Tw7 X-Received: by 2002:a63:6c83:0:b0:364:5899:a34b with SMTP id h125-20020a636c83000000b003645899a34bmr18398481pgc.47.1645503191780; Mon, 21 Feb 2022 20:13:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645503191; cv=none; d=google.com; s=arc-20160816; b=CvYy5+A14K4sQfrmi7nwfZTHC7Y36lHhJpie9doPvV9KSiVOX0B4YRZ5WUXF2qaVae ZCPfk8Ektyd/qZv7CmfFFqdG/hdQAgyrwRKq+4ipR6oAmEOc3IFUgE1JvuGDMgOvLkU4 HgMuhqeMhXE/dxPpbfLvkmvRbGeLxSIZNDsjec2MmVMJhjYvgT33LoNoEieueopv9MAD 8XVeBuMwX38G4O6xEYG9po759ch+DuKRaF2volo5fyx1PEur0JvtFvshC/p/dOxPUebA yXK167xc2vsRcOg+6YCCAtjyiWCSTG5A1RJ0UV7mjl2MGbHo2aYqWizNYWbncc72Fm8E vzAw== 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=K20xA0GfD9/UW7rk+qQM0UwFWxG3/gBQzZs7lxTeQ/Q=; b=UIoaP6ZjOa3Q8d3PLfSxoXuNb7/XZROxnHj9inv37iExgqDIYlnoSl29ruIUWKTGuP eCGXqWXNO/ZNzawsLI6Rz/s62qsDDG+p6cUBwsSs/JBW1PbFKpzShdC9Iri85fUoHFsL gV9knN0zvUVxjQ+qN7MVXaa7QVI/NazIvb/A65rjcp3ZevJ6hloN4525cq7TSAJ7XaZZ 9F/kfI0S8iO9UBSNdriJM6m0ASHOPmcaQ7FjKcPWWKkiroUGAzCKHCMV2VxHnAtJSGzz Tz9eEnVGghkpl3t5PlmXxOkLmRt+x41MZEK6klPsiMtBgKLaAGbrEQK0jc5MUcfgMedF mMIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=XQ5L4cuM; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id s10-20020a17090b070a00b001bc1d5f41e5si942483pjz.20.2022.02.21.20.13.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Feb 2022 20:13:11 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=XQ5L4cuM; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id D24057CDCA; Mon, 21 Feb 2022 20:13:01 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347097AbiBUJFJ (ORCPT + 99 others); Mon, 21 Feb 2022 04:05:09 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:58050 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347563AbiBUJBb (ORCPT ); Mon, 21 Feb 2022 04:01:31 -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 55D6822512; Mon, 21 Feb 2022 00:56:44 -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 3D5A1B80EB5; Mon, 21 Feb 2022 08:56:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 54751C340E9; Mon, 21 Feb 2022 08:56:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1645433771; bh=3hY4r8/3UO+KDlgWBI1PWNsgwmTFyNxZwI7NNxVqog0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XQ5L4cuMBd4DkEuor9d66Ysz7ijxThmhtGIS1FQG7E0wzRObtZEZbmpN0OhCB7iSs M3Az+DvTVZX/jBn+9NbRZrhQP70dNPbrldwlneuu020YSOY/xAIzj54VP/rQTqOwos ANGAKG4YxibrgUB1YPPmKPSvG1H3SsGr0dl39y44= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Guillaume Nault , Jakub Kicinski , Sudip Mukherjee Subject: [PATCH 4.19 19/58] xfrm: Dont accidentally set RTO_ONLINK in decode_session4() Date: Mon, 21 Feb 2022 09:49:12 +0100 Message-Id: <20220221084912.507636200@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220221084911.895146879@linuxfoundation.org> References: <20220221084911.895146879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 [sudip: manually backport to previous location] Signed-off-by: Sudip Mukherjee Signed-off-by: Greg Kroah-Hartman --- net/ipv4/xfrm4_policy.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/net/ipv4/xfrm4_policy.c +++ b/net/ipv4/xfrm4_policy.c @@ -17,6 +17,7 @@ #include #include #include +#include static struct dst_entry *__xfrm4_dst_lookup(struct net *net, struct flowi4 *fl4, int tos, int oif, @@ -126,7 +127,7 @@ _decode_session4(struct sk_buff *skb, st 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) {