Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp2091978ybp; Thu, 10 Oct 2019 02:03:10 -0700 (PDT) X-Google-Smtp-Source: APXvYqzq7rTjC6oSW8070Ru5fCvqd2shDHqq+qtHvzbBadFOETYUELtP1D8XP3phsReKidD+MMeP X-Received: by 2002:a17:906:24c9:: with SMTP id f9mr7054826ejb.201.1570698190685; Thu, 10 Oct 2019 02:03:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570698190; cv=none; d=google.com; s=arc-20160816; b=VCZvRdb3d/aHZWCPEw0st1ARhJs9NzW4bmBusAtk+MSSquWhQ76G5ZcSItqlv6/lpl bL07eEjcOTZ5AuKUiZvvQF18bamC7E16UjRdjQMECUelCsMFrSOOiofZqByyWky3vewU eis5vZ9jH52HhnpmGiHJnsV5Q/7NwkXoHrf7e81BA90NL9swv3iEIcTglK0DZd/zQMu2 /om8YygfS0WB5/QYTh2AWuMwlDlp6WhJOWVGSIlZPOfgA/vcy9htZWdTp3bFc9z65twh qVM6ore/U3xeOK6aTLjM6sl1FcUPokHplQLf9LaZ491Lu3HcZ3cpIiCy5V90fDq5fW7z r6Og== 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=H3tCfAzAs+q1rvIINTdWmMk9znaoZJiClTK0g1HsrSRdGFMYh8pR/kI/4rtBLzcked H0WpZLpSEYKb7DG8BQmhMR84mA2NkJH5EpOe3sPT/BgUeaBgiMILut8pZ6K68YF84nUB 6vPSY/4Huyu4Q72rtjRZSWnkevVSpIpU9Q5NKftcSpvEumRAFQmXx1gEZGFe/Hw0v5Lv 3p3GXMcsoDuizKusWvmDlkg7Sb1o1zS+Yqoh7FeRZHbDuAIt/5w7GyRqmbVrESKF7rga Rjv1F3nQcE8zlQuGqqb7wH9fTR/x/tDLTVK7gs/wl0fJHhrBrfQsDGRgPcwlZUb0A6kL F05A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=FXwrZ3NA; 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 g13si2746832ejf.133.2019.10.10.02.02.47; Thu, 10 Oct 2019 02:03:10 -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=FXwrZ3NA; 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 S2387863AbfJJIj1 (ORCPT + 99 others); Thu, 10 Oct 2019 04:39:27 -0400 Received: from mail.kernel.org ([198.145.29.99]:42918 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387430AbfJJIjZ (ORCPT ); Thu, 10 Oct 2019 04:39:25 -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 3FD1921920; Thu, 10 Oct 2019 08:39:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570696764; bh=ZwsGgjl9+rpPm+dqONwrfFcqeSGtvnpm4WmFQaz5YAQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FXwrZ3NA8GPEoFeoPA/ZJYcCKPxnhsWgpP2GpaUihRORuFe6GoQpISs6DupNbN2An Wd+7vc/mecqMakE6OtnzTLYA+kDlaiXo28ss1FRi87F0YkxGejxXXrMqR1+oretVHq tae0pQL4lp/dLX/XrmewgwSJSgbzfvZ1MOSYaxtM= 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 5.3 045/148] crypto: ccree - account for TEE not ready to report Date: Thu, 10 Oct 2019 10:35:06 +0200 Message-Id: <20191010083613.871875992@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191010083609.660878383@linuxfoundation.org> References: <20191010083609.660878383@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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; } /*