Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3664161pxb; Mon, 24 Jan 2022 14:48:41 -0800 (PST) X-Google-Smtp-Source: ABdhPJwiTooS+D180Qx+v0Z5Yvru150BRwROaqMCR0cZYwz8b4Y1LY+2AOZ74exIXS7Wrg5I1CG+ X-Received: by 2002:a65:5c87:: with SMTP id a7mr13638590pgt.600.1643064521717; Mon, 24 Jan 2022 14:48:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643064521; cv=none; d=google.com; s=arc-20160816; b=pyfC4zARO2sL11GojzXTzN5tBSvqG7Sdg5dr8jR02EBfy3rKthSFgUZmlLWN8k4Awj 87fysBDwTZRSJYBfzklxQt+3b0XJ+HseLglQgZ7OAmulO6gRq0S/lzmy3ezfAwOFdpK6 NBL7KMJB0cKo3oQoG80A0BRIEQCCy3bfaDy4IYBpiFBArPaQ5Lg9M/DOTgAsZQmUC99p eGpvvBj0HOubP/BOZfd21rD4Ll8cXnAij+Zawf78dUtvhdvnzT6HkTVrgGmFikDCETY1 E71SCzCmEMHaj6NZw3Ok+b0o7n7c6NFwxSbaIBy0FPrh+PIgHXwVz2xzhLmVLlaS9zFZ 37uw== 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=h1oCGjuZrCZLjtyleMKdMroXCTnanUa3iM+LGND+CT4=; b=Z61fPeF47gVaPmZDzO6yZnc8y4lJGVbvKd+YDGq3ac1jRB064QBwuzgseV3tUAxdLx cttHEJ2UPQcgHApwW2q6m1EqSU2B3Bi17rZ8qg4ywRCtRQ5ITnRY7Qs55OyhVnIa5thm gQE0S+r40RNyGWs9ED/WmPfuJVKiJbTSJaaiUY8Quep211mbPaZEXuOyALfydClVELkk iBi/fzrPULHH1NSRqB7WZCWfRUFHo+FI9kZmGgnK1H+8rOsUUjKSa93R9TbiAVphY4TR 1l79CpaM1RF28N+ZgNpnK2pvBXkR7IPwE/C/stGvEGvirtb81MCOzYfF2CweKfZiK6Ly NfNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=2s8EQ5tD; 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 lr17si699992pjb.102.2022.01.24.14.48.30; Mon, 24 Jan 2022 14:48:41 -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=2s8EQ5tD; 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 S1838649AbiAXWrC (ORCPT + 99 others); Mon, 24 Jan 2022 17:47:02 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:55434 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351335AbiAXVhL (ORCPT ); Mon, 24 Jan 2022 16:37:11 -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 6C6EC614CB; Mon, 24 Jan 2022 21:37:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 77EC7C340E4; Mon, 24 Jan 2022 21:37:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060228; bh=6NOPhziuYypkTM6BA48wy+IPkpY4HrxLprlwRYabKag=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2s8EQ5tDgKINW0xkfXCgv9EKE5NzrGTUKVIFw5i1C5cHEwUA0RD6dIIGznK0XgddG mlBZOw/k1z2hRLL6wv9zZhwECQK03C+mEA9VxPAZeZlv1liMm7xip3YVPFdT4G/I6J 3IXKt3hs2VsfOy17KRRxJNMcPh7y/7ezcbXmV1To= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nicolas Dichtel , Steffen Klassert Subject: [PATCH 5.16 0881/1039] xfrm: fix dflt policy check when there is no policy configured Date: Mon, 24 Jan 2022 19:44:30 +0100 Message-Id: <20220124184154.909528381@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: Nicolas Dichtel commit ec3bb890817e4398f2d46e12e2e205495b116be9 upstream. When there is no policy configured on the system, the default policy is checked in xfrm_route_forward. However, it was done with the wrong direction (XFRM_POLICY_FWD instead of XFRM_POLICY_OUT). The default policy for XFRM_POLICY_FWD was checked just before, with a call to xfrm[46]_policy_check(). CC: stable@vger.kernel.org Fixes: 2d151d39073a ("xfrm: Add possibility to set the default to block if we have no policy") Signed-off-by: Nicolas Dichtel Signed-off-by: Steffen Klassert Signed-off-by: Greg Kroah-Hartman --- include/net/xfrm.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/include/net/xfrm.h +++ b/include/net/xfrm.h @@ -1167,7 +1167,7 @@ static inline int xfrm_route_forward(str { struct net *net = dev_net(skb->dev); - if (xfrm_default_allow(net, XFRM_POLICY_FWD)) + if (xfrm_default_allow(net, XFRM_POLICY_OUT)) return !net->xfrm.policy_count[XFRM_POLICY_OUT] || (skb_dst(skb)->flags & DST_NOXFRM) || __xfrm_route_forward(skb, family);