Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp2087635ybp; Thu, 10 Oct 2019 01:59:17 -0700 (PDT) X-Google-Smtp-Source: APXvYqwY9LiaWEH04VIXlvN/kMNw8WEQDTWEUI1ojC70cjxTI0Sw92YpRKsbvHDPehmNTa6dNZfw X-Received: by 2002:a17:906:c4a:: with SMTP id t10mr7073551ejf.290.1570697957880; Thu, 10 Oct 2019 01:59:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570697957; cv=none; d=google.com; s=arc-20160816; b=TWzGxjQBqyZgfQTHA1t7eze4YT5Von4GefawV2FbKTQAk5uDuzNjgmEYCxNsnQ4YzB A6WYCOeArQAmEtJmGGyg0Nt7slmTdItBBSZYGeLtl3JttPQUIMVpviDlEqZ+syyJsdYx x7U9af5VIv9ClOcDo+/xa1IpMDyyuPcaTK2KAt2mJRd2IMWmspCffG0osRO8Jd0jkq8F mrkHEJ/Ao/UOfh47ubRkPKqqeLua5D5N2UIZPtdyiJSMb6Kf8qZdgT3ECyVfcERTSlLt pL8j05iaFcz2ihrJHaxoYB+hj954RDEJIhODauTnxULf5/hM12vZzVpB+TbAoa7lWTul 4XEw== 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 l9si2801812ejx.412.2019.10.10.01.58.54; Thu, 10 Oct 2019 01:59:17 -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 S2389112AbfJJIpV (ORCPT + 99 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 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; } /*