Received: by 10.223.176.5 with SMTP id f5csp3364714wra; Mon, 29 Jan 2018 12:12:31 -0800 (PST) X-Google-Smtp-Source: AH8x227YIneUeVvYoGo/nGqhf3w8h77m6vZNTNOyvJ3CY//zW8Y6TJ4/Qv0xcRmbmd2Qo9c1QnaF X-Received: by 2002:a17:902:424:: with SMTP id 33-v6mr22525336ple.57.1517256751895; Mon, 29 Jan 2018 12:12:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517256751; cv=none; d=google.com; s=arc-20160816; b=fkQC8uopct6ALt4uNGEm6NfBahNMrWsRiMKU2LsWWjo+5ulisW6Vo3eKpnL41I3Ojr 5nPdE+HO6J1BRV2qFHf3ZVxeXk4CVLj4J43iYnHYVEEe9cSPrJ/RCozIZ15lcHhI/6wL fbq1kisxiLplNMP4vrT/QZ+Crgi6LqPF+sroHapJcPYY6FeoPsUFzNFCCFXbFOgCpoRE 4Ooph4pBiK+j6Pl1RvytcP0wrsIiCNAzygjsywJgn0CiqW5aYJP84Dotj40RJrQOPETH ncyQso2Fw8DxAqQuWW8Kp7TK7JVJySybj25YzWWJIR2HTcb0+me9O2T0cKUF5/AM1niK ANaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=LUqBR8gYYOfc1HZeYSw3JKIi85Me5CUmncQUe/NpMwc=; b=XJUFtbo99OIU+Ql2hL6YOwoHP9bibhh0ZdsLGm8+cyJ2VbK4yhL51OcRA2gqco3F6G 9OgnVf7RGjyTjV7m0xP5+dTPoL9sp9Mpt3cmZVx3Bp4HJJTfhpLmuoyj5Z1ZQZRp8YCw JlHBHIBNsRcYpkdkGnVBPeRmhlpksNQfmCp/T7rrJC36y8PkRPMx0gcmwmjZ8WAGC7jq N2pL+RLU+Gszbf3v5CbDMeq+hNDPUrypxiUr93/qdgDGpbxbhw8I2Uh/k4oHTYE+i5YL qN1lRJhEMSGdgg1+qNA3hFDTs8M6AzeFs4ScqXimSyJEGRQi86R+kX3muUvECtITqDgG RzXw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g24-v6si9062019plj.50.2018.01.29.12.12.17; Mon, 29 Jan 2018 12:12:31 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753787AbeA2ULo (ORCPT + 99 others); Mon, 29 Jan 2018 15:11:44 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:32768 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753766AbeA2ULl (ORCPT ); Mon, 29 Jan 2018 15:11:41 -0500 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 8D8943000; Mon, 29 Jan 2018 13:09:00 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Darius Ski , Steffen Klassert Subject: [PATCH 4.14 06/71] xfrm: Fix a race in the xdst pcpu cache. Date: Mon, 29 Jan 2018 13:56:34 +0100 Message-Id: <20180129123827.741051473@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180129123827.271171825@linuxfoundation.org> References: <20180129123827.271171825@linuxfoundation.org> User-Agent: quilt/0.65 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Steffen Klassert commit 76a4201191814a0061cb5c861fafb9ecaa764846 upstream. We need to run xfrm_resolve_and_create_bundle() with bottom halves off. Otherwise we may reuse an already released dst_enty when the xfrm lookup functions are called from process context. Fixes: c30d78c14a813db39a647b6a348b428 ("xfrm: add xdst pcpu cache") Reported-by: Darius Ski Signed-off-by: Steffen Klassert Acked-by: David Miller , Signed-off-by: Greg Kroah-Hartman --- net/xfrm/xfrm_policy.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) --- a/net/xfrm/xfrm_policy.c +++ b/net/xfrm/xfrm_policy.c @@ -2056,8 +2056,11 @@ xfrm_bundle_lookup(struct net *net, cons if (num_xfrms <= 0) goto make_dummy_bundle; + local_bh_disable(); xdst = xfrm_resolve_and_create_bundle(pols, num_pols, fl, family, - xflo->dst_orig); + xflo->dst_orig); + local_bh_enable(); + if (IS_ERR(xdst)) { err = PTR_ERR(xdst); if (err != -EAGAIN) @@ -2144,9 +2147,12 @@ struct dst_entry *xfrm_lookup(struct net goto no_transform; } + local_bh_disable(); xdst = xfrm_resolve_and_create_bundle( pols, num_pols, fl, family, dst_orig); + local_bh_enable(); + if (IS_ERR(xdst)) { xfrm_pols_put(pols, num_pols); err = PTR_ERR(xdst);