From patchwork Thu Oct 10 08:35:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 175734 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp1992317ill; Thu, 10 Oct 2019 01:58:51 -0700 (PDT) X-Google-Smtp-Source: APXvYqwFGTUd6dCbbPvh9MHTlnCqyx3tPb4PjixaUcdked4ENrpv2+XP08Gq2hUcWmImwT6fxwki X-Received: by 2002:a05:6402:1514:: with SMTP id f20mr7104295edw.35.1570697930892; Thu, 10 Oct 2019 01:58:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570697930; cv=none; d=google.com; s=arc-20160816; b=iDKEjs8DfDrcI1fVDxNdDT717YKP1iGG+xABVPKkoLIEDasNdPbmSG4PS4QbJo68Gi 4375EpYFD/w9H1Sl+L/GwrEzf7VMBPHAMuDSPjEplc5RE3S9W/atZlO0Xee7xK61oSZP JNY4mH1bvUAJ0rqg1nTUy2GTwzQiI/p1fXy4KeqgcNwux9mLQVrMfxZHfo5i2xUfoK17 F397OL45XN892hrtLzJedlLWcn5DN+NctJdG8KvZah5OMqRka4w9Oj0lmH6qm45kaGvR w5SgqxpBOz2J6zrqU7fyRKeepUULV68SLoYBs4mGnU4GhDxd947tIpPJKrXZMIWv9ezE ID3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=FE+1wEawqtBxi025TOTIuWTjnHUOgZN51bocypmwzD8=; b=CaCwaY+MVTMR1+AegtTjsiSILUEs5RW2KS35G13bfpniJwfdDxJOg25v+x2OSryFGE wJDObD+C4d1uE0lWNVo0stkYcL2+1VcM2GzhjXIUlx/+6z+FSummq8r+layCWJvFZnr3 w0z/INBUUeup3FWh5yLQyyTrmN2k2azsNH1qYFn8sOXaIOkIlj3Pt3sti0Bo+LLoBegm TWiJeC5N7HK5cdoyZrRkdkIwN+G7volVPh0506UKejrz8mr1+UoqwjT3wTxZDmVnNyDr NNCK4u5Hd3lngSgQHWAwR6e7+MYf3jvoEb8UD2mc+5++xU43IqjVsG7B9L7zSaxhx9XV f52A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=OSToX5To; 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 h26si3309693edb.141.2019.10.10.01.58.50; Thu, 10 Oct 2019 01:58:50 -0700 (PDT) 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; dkim=pass header.i=@kernel.org header.s=default header.b=OSToX5To; 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 S2389116AbfJJIpV (ORCPT + 26 others); Thu, 10 Oct 2019 04:45:21 -0400 Received: from mail.kernel.org ([198.145.29.99]:50874 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388040AbfJJIpT (ORCPT ); Thu, 10 Oct 2019 04:45:19 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B32082190F; Thu, 10 Oct 2019 08:45:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570697119; bh=ZwsGgjl9+rpPm+dqONwrfFcqeSGtvnpm4WmFQaz5YAQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OSToX5ToT7bCOOYatyymi+59f8TuFk6CFvXEr5XVvSKjAorhg/Dv2t3MrkwxC3myj IQkuyn0IaBO62FoE8Dpch/TwYf6mK8egKcWaW4hFrod8vM3q9Kw5E57Uu+ZQDrPBlO wJyua5buN0fG+LgyWIpw89abo4k61xz5XaW6mbK4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Gilad Ben-Yossef , Herbert Xu Subject: [PATCH 4.19 025/114] crypto: ccree - account for TEE not ready to report Date: Thu, 10 Oct 2019 10:35:32 +0200 Message-Id: <20191010083555.614023425@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191010083544.711104709@linuxfoundation.org> References: <20191010083544.711104709@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Gilad Ben-Yossef commit 76a95bd8f9e10cade9c4c8df93b5c20ff45dc0f5 upstream. When ccree driver runs it checks the state of the Trusted Execution Environment CryptoCell driver before proceeding. We did not account for cases where the TEE side is not ready or not available at all. Fix it by only considering TEE error state after sync with the TEE side driver. Signed-off-by: Gilad Ben-Yossef Fixes: ab8ec9658f5a ("crypto: ccree - add FIPS support") CC: stable@vger.kernel.org # v4.17+ Signed-off-by: Herbert Xu Signed-off-by: Greg Kroah-Hartman --- drivers/crypto/ccree/cc_fips.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) --- a/drivers/crypto/ccree/cc_fips.c +++ b/drivers/crypto/ccree/cc_fips.c @@ -21,7 +21,13 @@ static bool cc_get_tee_fips_status(struc u32 reg; reg = cc_ioread(drvdata, CC_REG(GPR_HOST)); - return (reg == (CC_FIPS_SYNC_TEE_STATUS | CC_FIPS_SYNC_MODULE_OK)); + /* Did the TEE report status? */ + if (reg & CC_FIPS_SYNC_TEE_STATUS) + /* Yes. Is it OK? */ + return (reg & CC_FIPS_SYNC_MODULE_OK); + + /* No. It's either not in use or will be reported later */ + return true; } /*