Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3578424pxb; Mon, 24 Jan 2022 12:40:32 -0800 (PST) X-Google-Smtp-Source: ABdhPJwCpsp3mrG73Y0Xu8eDXH9FRUBIDgLsTi7Y9nB4AL7F3Yrvs2DVDQSpZgJAW2ciOZCzilok X-Received: by 2002:a17:90b:3905:: with SMTP id ob5mr70369pjb.179.1643056710669; Mon, 24 Jan 2022 12:38:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643056710; cv=none; d=google.com; s=arc-20160816; b=zoSE32/yIuK4g4PgeYyjjqMtpy1RAp49rQAlODo1Fc2Ku0WZDUqSe86y8InTW8/8gA C7AwyjCKvuR74Ndx9YzPu7tlSoqH4M9jhf+O5wODHuT1r88n7tn1+Ot5I6VJMqCcLywm 17PRN4qh0bEW2zR7MVRXKpDA6iD70JZ21a1R8fU+1YSAc87J/gtvSDsTKyJc+WFD9Jgx ilhURXr/V+0QYoysEWPPYpmCOojF0VA7EO5x8R82k40fYvIgzAWuyqQCvoG4+s47/EC2 lbqFLHJWE59egw/Zbe+UYuKS+oUJ0yzeJ4c1yGO4+FB2hntS3rgYJGR9WTZm+0Fe3pCD lUZQ== 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=JZxhkeUXFyX0KBBhqfmy3xOtPgIPaVPh1WtmYiTSEDs=; b=AG4C7uxRfQjMB3nGo2i1LtAQkc3X2iHsDzdOe49E+0MqaPJvFCbXB1Jjs4Lib5TK26 A00OwYEnx/PpJ4Ii9xuu1RB0+0xzrJoV/yc3GQY+dZpb5awjQ6bYaEmdo5LDjieuuW0q RbOXxFaaOMnWKtIpJ+bTiQgRrImPxIZ9vHRe3H3Mz6fCNKrw7Ib1QsB38j6MqdfQgzbw d2W9yWdfNv5uGJSia96TkrsXyUwYkLbWXEXtwx/s4xRgSj8iRdhwxvZ3ZTcQj2YLmHXJ fKmygkQhxyhRnP6NQ/VVEUAMGUlsxPuB6DK1hsoRCGm4VBwPCZqvwLzNgP4B/JnrfLXF Kmow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=hsCzJjof; 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 l11si8141670pga.8.2022.01.24.12.38.11; Mon, 24 Jan 2022 12:38:30 -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=hsCzJjof; 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 S1357394AbiAXTty (ORCPT + 99 others); Mon, 24 Jan 2022 14:49:54 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:37238 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354924AbiAXTjj (ORCPT ); Mon, 24 Jan 2022 14:39:39 -0500 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 dfw.source.kernel.org (Postfix) with ESMTPS id 34A256131E; Mon, 24 Jan 2022 19:39:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 077B9C340E5; Mon, 24 Jan 2022 19:39:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053177; bh=NYJ7RpJ3Zpj/TBTgN+RPZymLDIAJnEHe1ThwT5uOekQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hsCzJjof/heIHnsjTnx/QvxYNglJY2KmXefmizHAcdqf5c+ehwayZjQrLAvZJzCFn xJHO16eWsUe0AH/Z2G/PiM/K4K/yH/HSiJ/+qqSJrIk1saw6AiIwVaHrSqGZwM/Alp X7QZrnWetwyWM8RCbfDIMCnTvpZn24YH4qLA+CUU= 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.4 301/320] xfrm: Dont accidentally set RTO_ONLINK in decode_session4() Date: Mon, 24 Jan 2022 19:44:45 +0100 Message-Id: <20220124184004.188391880@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@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 @@ -3282,7 +3283,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) {