From patchwork Thu Oct 10 08:35:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 175710 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp1975078ill; Thu, 10 Oct 2019 01:39:29 -0700 (PDT) X-Google-Smtp-Source: APXvYqxyGVsdm6DO2rC0xeOJ0GZgTZSGvoq7aAFq3xgNJ3Rt10fgJoUwjI+AiDHhDzvUPMNATCH6 X-Received: by 2002:a17:906:4a97:: with SMTP id x23mr6743245eju.218.1570696769196; Thu, 10 Oct 2019 01:39:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570696769; cv=none; d=google.com; s=arc-20160816; b=YDZBFFJ0SKwjEyn8o42BTRI74UCkf79KLs6R4PmGsPNATDpmmLTqOLtKxOeGyJFTR7 xOP/DBi5YhpVxB205zEe7Z/VLVPg3Vu+qsypkjWpHw9AOFkmMDlG/vpUZ4m+VVsyryxr H9FKLgrBP8h/dPRgy+Cc5kyVKibKrXTZdRyGx6tlsD+vRFnqaia4EWBpAI700PVrKSKA nXJC8Zg9HrG+bGj7AsPNPN8mi+t/hAHhs2YohMr6/I+XyYFKgnQausINNHv3wvQG2ej+ CNCDb7RNnR1pXzKNy0VTcHAOPnTFMT9Ar0KqAyiZdvt6QDJv2VhKIiWokfaDNkL6ynK+ 4ilg== 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 e6si2872415ejb.348.2019.10.10.01.39.29; Thu, 10 Oct 2019 01:39:29 -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 S2387868AbfJJIj1 (ORCPT + 26 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 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; } /*