Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3685239pxb; Mon, 24 Jan 2022 15:18:48 -0800 (PST) X-Google-Smtp-Source: ABdhPJw00TagmiVYGjmqjldU7Mr3dlGX9trnMU9OrMDNT/wUTwc2aVFvHYu2PpviiAtL1yHGfQSe X-Received: by 2002:a05:6a00:148c:b0:4c2:6f06:8c70 with SMTP id v12-20020a056a00148c00b004c26f068c70mr16178799pfu.48.1643066328711; Mon, 24 Jan 2022 15:18:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643066328; cv=none; d=google.com; s=arc-20160816; b=Ba5UU2cPwslzTvabNSJ7Y5AZCnS/h8+3vaaQy05WL1lCaXt+W9g92/tWvvr3GhRVj0 TF65T4IV9mpNpyDZo9lpF7goUfiKIn2PwjTO1jcadDyl+l9/f/y4/f38aExUyd/NnXp8 LxcFWZcRnxj1LKKAMslRFNwYga2KGToAe2250MXhpPBgl/Uegbxd0AUQb4ixdg5ZQip9 NVmwrj+Dv5Zy+9+4d0BWSVtIcTaRcLHWrnWNITJ1lfoaRtNl3oGZOy2m1/p0Zkti1TrJ kSwPKkzYaQLmeK7KgPXijsRkijMhJZDq8/htYeHen0F5TuUCKcpNrIOmNK9FFjrl9nXI bwww== 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=nDCA//VrdKZd9iM9IkQjlpE1vcSHuRCtccTMJ+uC+Cc=; b=R3Hu/jeN3W2H2JVqv2h5afuiCxTQ1VUSDDDt8jb26p9FnYlkHsKCq1uwGvekeIcMXG d5zplO4Q3SpyDrw8hin6yKfJZndFQXaKAAyFr6d/M7tcBBlLQw0adQykYK2h3AEHSb4Y hsXP+pLcbov+XpRvUhPzCHcxXWA9Zw4k6xVx+moSkTUZR4RxAuYKATqNZUr+nY0rk9k4 AMtyU68VCiN1PYyWMv3w6OCJH+XnvmPVhRdNtcV8cTJNXr3iwOe8oQuswm7dqkv40UNL E8Q8/f0fnySMT+ld5EFFB7fm/WIwUU2KAmxlsPbdY5+7SpKu3w0+/InK4WaQDX9xJcPa tbVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="j/zsgJ/E"; 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 16si16271488pgs.428.2022.01.24.15.18.36; Mon, 24 Jan 2022 15:18:48 -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="j/zsgJ/E"; 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 S1845414AbiAXXMO (ORCPT + 99 others); Mon, 24 Jan 2022 18:12:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1584555AbiAXWVY (ORCPT ); Mon, 24 Jan 2022 17:21:24 -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 1CC54C0424D5; Mon, 24 Jan 2022 12:50:34 -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 CD2D9B80FA1; Mon, 24 Jan 2022 20:50:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 04891C340E5; Mon, 24 Jan 2022 20:50:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057431; bh=S6hpoQrFRb7CVdHf4+uQee5G+SjwJeDuyUv4UHKTi+4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=j/zsgJ/E95o5Qns17fCDiJ/9O/VU6/+tttVbYLw9vowEsR9W3NfwPyQZPmk0HNfo6 TOWZrExAVHsT6DofnFg6JUhOUYeTK8CJZup3Y53me1m7vYhZv88CYFN7kd/rpEthwi q2RqVYDP7ivy9R2t+2aEW6a6iXv+sKZXskbSdUSg= 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.15 810/846] xfrm: Dont accidentally set RTO_ONLINK in decode_session4() Date: Mon, 24 Jan 2022 19:45:27 +0100 Message-Id: <20220124184128.865192336@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184100.867127425@linuxfoundation.org> References: <20220124184100.867127425@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 @@ -3297,7 +3298,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) {