Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3618999pxb; Mon, 24 Jan 2022 13:39:15 -0800 (PST) X-Google-Smtp-Source: ABdhPJxXDTjdx/EuH7vZvr/i/Q+GtNsF5TJzRPKbj3WGEWiJCFmJZ58IY6VJNSYIycJzWoVsC2z6 X-Received: by 2002:a17:90b:1883:: with SMTP id mn3mr188070pjb.153.1643060242201; Mon, 24 Jan 2022 13:37:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643060242; cv=none; d=google.com; s=arc-20160816; b=BLMXBxllSVeKchaYuCTYB6ZFVveJjppwsWKw0oJRPIZ3crmCi2r3KAapnvejlFfeFu LQLonEiCDvk1FPlrErvG27pXu6Nj1F77empCN81MApgoqtw816WOW+YBHP/Fc+RDz8lY xsACKXncbRlMJo1glhUcv+OxXTDnhuKM0+BR+McJ19p26TWfJBNUCGomr3gmhaL27TOt FJQ7aM4hwPvzIiFtjhWuYFvnkQg7dWrMSKfeaNSHWFiWy5kELJIJW6rHz3SL9fty7Vp5 hMwMWDyWTpevX6vXLBziFep6GkUWp3grZ+ntycL715M57ka2RVnxEyRapfNY+zscQi3q WEOg== 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=J1RlxrmNnzqIJXOfONOfovYqwbfE7c5yoIW0tNbfGY3vu9EQ0xLxeUK9ZaS2YMIKLX H5sxCCANYb/e9fum4j/HmbJIx9wCGOpfCYn2eWjCv6mAFdoDXzaLO9C8BTn8oj7UxpYK +FUckFq8txWMQRwvLBybODTEqScoHwb/heurZsWbha9MzfnRgejy3A2bwiLyq+mBF1jM 0H2rzqW4WcCZmmU7VEGikXyEs9S3CmaNa0xLEU257X6BndPAtg/CtITMG5D0JNasmzm2 VFG1ZqlxiJ9NkeOUf5PiWmGr+WoDJ1W/5gg2vtrWnLvABiSel7q1YAoeNzb63ABJMTB3 YxLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=HnF0mqSd; 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 n18si13201166pff.307.2022.01.24.13.37.09; Mon, 24 Jan 2022 13:37:22 -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=HnF0mqSd; 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 S1448234AbiAXVMO (ORCPT + 99 others); Mon, 24 Jan 2022 16:12:14 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:46322 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1390455AbiAXUp0 (ORCPT ); Mon, 24 Jan 2022 15:45:26 -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 ams.source.kernel.org (Postfix) with ESMTPS id 0724CB81057; Mon, 24 Jan 2022 20:45:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 019EBC340E5; Mon, 24 Jan 2022 20:45:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057123; bh=6NOPhziuYypkTM6BA48wy+IPkpY4HrxLprlwRYabKag=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HnF0mqSdU1BLneWQpx//NPVmSAyTvEKlpA4fzWwlqO6XCWnvl/SXkRUGaUs34HOEu IFXbXFtrW2NO/fz5w7G1mtWQB5QAgmvgqN4PCmQcqFJZFw2O2Qq5FSIH9GioYV+LTR hM3t5jKnvTU4HXDCv6TshXF3HjYHGu/MpOl0cv5E= 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.15 709/846] xfrm: fix dflt policy check when there is no policy configured Date: Mon, 24 Jan 2022 19:43:46 +0100 Message-Id: <20220124184125.491447877@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: 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);