From patchwork Mon May 20 12:13:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 164619 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp228283ili; Mon, 20 May 2019 05:32:02 -0700 (PDT) X-Google-Smtp-Source: APXvYqzeKIwsbEDCiajuB93z7Lm2PeQrP9P3UaGyqIt+xvZzLN74O1C516egq9K1BVXPXbHwxtea X-Received: by 2002:a63:2226:: with SMTP id i38mr863667pgi.403.1558355521956; Mon, 20 May 2019 05:32:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558355521; cv=none; d=google.com; s=arc-20160816; b=coEoJATB23nIu8YSJRTKUG4P+r6AUnXmnnUJuH+ApWagtZuzkJPkZWgHLdN9BR3u6j YrcyVTespXNOvpG1FbqnPbOgU9dTAr6xAiCdVe/rmtA2hmexING7YA7S0G7pRdrwEFr+ H9NkMal+u+olfgnL6sUirGWJvsWz8AoknWwGLohjQTrZM3vzFg9yapN7cPQuEELceBej 5Y03sRJ2w6ByvuATkHqrnoeNWd7gKakZESm07UJO6h/BXWFtIwIn5cr6UXA6rdjHQbqK CSCW5ZyQ8dzVBL3xE+u9cT/UZrhozC/kZ5nV6z/yNUqDg/xvTWF2drGoHHK2bnbVj/xD CBtw== 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=t1igxxTsgiZBpZjq5+NokYAP6oSP0XgBIciliWpoY34=; b=MIMPdl9AKsFjcmPt4xr0xurxh6scKPx0CiKUD75J/nwxBlCe/Y6rdPM+3nbgPngvVa Epnt+ri510DymSuk2uxqZz3s2JWs6AtAiOuxTdK41GqY2fTKl4O88sQvAIr3kNuXz3p0 SV+zDd5Oyj0VR/YYX89Hz02hHYOG7cAJcFoIDTbffftWmA/BmXe9cHa+U5t5XfuFj9R/ iu2/Bnfe0Bb0uBEtQ7rOF3GbkrUg5N8B0JL6f/WJcXDRq/EG8S4gBtsLkEoyc6rUJ+R1 yQajUQL6SP23mzDeKq6mOeD+/4ERWxK8YXsNniYcD1gmgpqrb27saoM4xd/G8SdObWWn x7qQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=O6Wwx4ap; 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 e11si12396932pgv.569.2019.05.20.05.31.57; Mon, 20 May 2019 05:32:01 -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=O6Wwx4ap; 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 S2390370AbfETMbg (ORCPT + 30 others); Mon, 20 May 2019 08:31:36 -0400 Received: from mail.kernel.org ([198.145.29.99]:48148 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390351AbfETMbe (ORCPT ); Mon, 20 May 2019 08:31:34 -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 945F0216FD; Mon, 20 May 2019 12:31:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1558355493; bh=jHnr8GD1aKn2Y3iOscmw3lW7VcwC0q2BQGI0AZcz3N8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=O6Wwx4apx/MVLroV3NrPk2LWsU0Gk9+6CmiqZ+X5NVGR9vobvmzHUWkjBT5vGp9FY QBGEHs6RMBnuHDgnvqWb7wLvIzlQJk/exIunQyiQgY24iRgLuUppeeWA9gKrdIx3Qm BSjkHEg2IanYaJgF5yBzgTOl3F3mUzMB9n0fx7DA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marc Zyngier , Vincenzo Frascino , Thomas Gleixner , Will Deacon Subject: [PATCH 5.1 016/128] arm64: arch_timer: Ensure counter register reads occur with seqlock held Date: Mon, 20 May 2019 14:13:23 +0200 Message-Id: <20190520115250.577618868@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190520115249.449077487@linuxfoundation.org> References: <20190520115249.449077487@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: Will Deacon commit 75a19a0202db21638a1c2b424afb867e1f9a2376 upstream. When executing clock_gettime(), either in the vDSO or via a system call, we need to ensure that the read of the counter register occurs within the seqlock reader critical section. This ensures that updates to the clocksource parameters (e.g. the multiplier) are consistent with the counter value and therefore avoids the situation where time appears to go backwards across multiple reads. Extend the vDSO logic so that the seqlock critical section covers the read of the counter register as well as accesses to the data page. Since reads of the counter system registers are not ordered by memory barrier instructions, introduce dependency ordering from the counter read to a subsequent memory access so that the seqlock memory barriers apply to the counter access in both the vDSO and the system call paths. Cc: Cc: Marc Zyngier Tested-by: Vincenzo Frascino Link: https://lore.kernel.org/linux-arm-kernel/alpine.DEB.2.21.1902081950260.1662@nanos.tec.linutronix.de/ Reported-by: Thomas Gleixner Signed-off-by: Will Deacon Signed-off-by: Greg Kroah-Hartman --- arch/arm64/include/asm/arch_timer.h | 33 +++++++++++++++++++++++++++++++-- arch/arm64/kernel/vdso/gettimeofday.S | 15 +++++++++++---- 2 files changed, 42 insertions(+), 6 deletions(-) --- a/arch/arm64/include/asm/arch_timer.h +++ b/arch/arm64/include/asm/arch_timer.h @@ -148,18 +148,47 @@ static inline void arch_timer_set_cntkct isb(); } +/* + * Ensure that reads of the counter are treated the same as memory reads + * for the purposes of ordering by subsequent memory barriers. + * + * This insanity brought to you by speculative system register reads, + * out-of-order memory accesses, sequence locks and Thomas Gleixner. + * + * http://lists.infradead.org/pipermail/linux-arm-kernel/2019-February/631195.html + */ +#define arch_counter_enforce_ordering(val) do { \ + u64 tmp, _val = (val); \ + \ + asm volatile( \ + " eor %0, %1, %1\n" \ + " add %0, sp, %0\n" \ + " ldr xzr, [%0]" \ + : "=r" (tmp) : "r" (_val)); \ +} while (0) + static inline u64 arch_counter_get_cntpct(void) { + u64 cnt; + isb(); - return arch_timer_reg_read_stable(cntpct_el0); + cnt = arch_timer_reg_read_stable(cntpct_el0); + arch_counter_enforce_ordering(cnt); + return cnt; } static inline u64 arch_counter_get_cntvct(void) { + u64 cnt; + isb(); - return arch_timer_reg_read_stable(cntvct_el0); + cnt = arch_timer_reg_read_stable(cntvct_el0); + arch_counter_enforce_ordering(cnt); + return cnt; } +#undef arch_counter_enforce_ordering + static inline int arch_timer_arch_init(void) { return 0; --- a/arch/arm64/kernel/vdso/gettimeofday.S +++ b/arch/arm64/kernel/vdso/gettimeofday.S @@ -73,6 +73,13 @@ x_tmp .req x8 movn x_tmp, #0xff00, lsl #48 and \res, x_tmp, \res mul \res, \res, \mult + /* + * Fake address dependency from the value computed from the counter + * register to subsequent data page accesses so that the sequence + * locking also orders the read of the counter. + */ + and x_tmp, \res, xzr + add vdso_data, vdso_data, x_tmp .endm /* @@ -147,12 +154,12 @@ ENTRY(__kernel_gettimeofday) /* w11 = cs_mono_mult, w12 = cs_shift */ ldp w11, w12, [vdso_data, #VDSO_CS_MONO_MULT] ldp x13, x14, [vdso_data, #VDSO_XTIME_CLK_SEC] - seqcnt_check fail=1b get_nsec_per_sec res=x9 lsl x9, x9, x12 get_clock_shifted_nsec res=x15, cycle_last=x10, mult=x11 + seqcnt_check fail=1b get_ts_realtime res_sec=x10, res_nsec=x11, \ clock_nsec=x15, xtime_sec=x13, xtime_nsec=x14, nsec_to_sec=x9 @@ -211,13 +218,13 @@ realtime: /* w11 = cs_mono_mult, w12 = cs_shift */ ldp w11, w12, [vdso_data, #VDSO_CS_MONO_MULT] ldp x13, x14, [vdso_data, #VDSO_XTIME_CLK_SEC] - seqcnt_check fail=realtime /* All computations are done with left-shifted nsecs. */ get_nsec_per_sec res=x9 lsl x9, x9, x12 get_clock_shifted_nsec res=x15, cycle_last=x10, mult=x11 + seqcnt_check fail=realtime get_ts_realtime res_sec=x10, res_nsec=x11, \ clock_nsec=x15, xtime_sec=x13, xtime_nsec=x14, nsec_to_sec=x9 clock_gettime_return, shift=1 @@ -231,7 +238,6 @@ monotonic: ldp w11, w12, [vdso_data, #VDSO_CS_MONO_MULT] ldp x13, x14, [vdso_data, #VDSO_XTIME_CLK_SEC] ldp x3, x4, [vdso_data, #VDSO_WTM_CLK_SEC] - seqcnt_check fail=monotonic /* All computations are done with left-shifted nsecs. */ lsl x4, x4, x12 @@ -239,6 +245,7 @@ monotonic: lsl x9, x9, x12 get_clock_shifted_nsec res=x15, cycle_last=x10, mult=x11 + seqcnt_check fail=monotonic get_ts_realtime res_sec=x10, res_nsec=x11, \ clock_nsec=x15, xtime_sec=x13, xtime_nsec=x14, nsec_to_sec=x9 @@ -253,13 +260,13 @@ monotonic_raw: /* w11 = cs_raw_mult, w12 = cs_shift */ ldp w12, w11, [vdso_data, #VDSO_CS_SHIFT] ldp x13, x14, [vdso_data, #VDSO_RAW_TIME_SEC] - seqcnt_check fail=monotonic_raw /* All computations are done with left-shifted nsecs. */ get_nsec_per_sec res=x9 lsl x9, x9, x12 get_clock_shifted_nsec res=x15, cycle_last=x10, mult=x11 + seqcnt_check fail=monotonic_raw get_ts_clock_raw res_sec=x10, res_nsec=x11, \ clock_nsec=x15, nsec_to_sec=x9 From patchwork Mon May 20 12:14:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 164628 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp238976ili; Mon, 20 May 2019 05:42:15 -0700 (PDT) X-Google-Smtp-Source: APXvYqzuiVmb/0+unMs71CHfwxj9Q91v9CjIcft6aHOopOw4qvRzhoSGGcl/ruK+o1zqyvDhcAUr X-Received: by 2002:a17:902:e7:: with SMTP id a94mr50826821pla.182.1558356135489; Mon, 20 May 2019 05:42:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558356135; cv=none; d=google.com; s=arc-20160816; b=0hiv4YYTXia27G5IfWLdmchpXbW6PT8bbW/2Kac7OgcgCEY3AX6mFvToe5YYhSMi+4 qFJp/I8p5brm/SNR7Q1HLIAHWrkfkVa1oMm1X2Az1JlBeElrywpv8ZuJ4WsKnaqDd9pT b7GS5K4gW6kBKZsyg6PecMgqsmEEwJEjVRA7cB5v2zxspCuU4auEbkhvyUCqeG0HXkx+ VNU3VNxpe8TVsH7AIF+qiO5ElvhT4P2uFxuBFQxu2SmdD2IxP0a/JqX7RYwSicISjTRJ w8kAl0Wr/xpLrQdV43D3XswPujndhluTqQ57RlS7sKxt/EJn+NV2m4BEweL/TbjDl3K6 uI4g== 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=LtroVFnyPKtphhy4gu8/w51VaQjDJn9KLsOjVGnTQlo=; b=l6xtsewCNDN2oHI/hWMJ634u+wb3hT9uWWAENZgwBAQ0WFWlMJsrUTX4u50qPLhbdK /cPXcIKrpAufSDTvqPrihI4uUOrgICcuzfK8ff+y01/+sToESbEv5/AEkCTdnMytE69i vLAux5PjTuqB907ISbK+wjAb/4bCFhjgVlwc3v1t4faYvuXtBXXVrqt3WHd5hkVYTF4/ V7Ws8+jvZ4T15DhkOamO5LoKvCSpIIcAEcn2Ogj/xussIWl+JJKzvlD9JCD8FRZiRHgX Yg3HQLp2xhCRvlOCv+v68UVUemlajclOZ51tYZq23/PqT09uhj0lxJpeIVoP7L6HD+0s 34Cg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=XnuQro13; 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 e11si12396932pgv.569.2019.05.20.05.42.11; Mon, 20 May 2019 05:42:15 -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=XnuQro13; 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 S2390802AbfETMdt (ORCPT + 30 others); Mon, 20 May 2019 08:33:49 -0400 Received: from mail.kernel.org ([198.145.29.99]:50890 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388747AbfETMdo (ORCPT ); Mon, 20 May 2019 08:33:44 -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 3EECA216C4; Mon, 20 May 2019 12:33:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1558355623; bh=N8d2+4SnFNE53BBI5L7qN6qxAsHj6sYtOtlPLCR3Gi8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XnuQro13hitw8u8mROkRHhXfs78J5KZ+U/Bdk2i926WfhGVSzrQHlX/yvLnymQkgB p6seD953YHR7tzxLMoBeVZqUkONz27jVgKg5/HWZivH8prlnbSsLJW062ZAC9TBiPZ dGdOKPQqdKaZGS+FsWHRBFJcs7i1Vct+m0QWiOQM= 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.1 063/128] crypto: ccree - use correct internal state sizes for export Date: Mon, 20 May 2019 14:14:10 +0200 Message-Id: <20190520115254.045239986@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190520115249.449077487@linuxfoundation.org> References: <20190520115249.449077487@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 f3df82b468f00cca241d96ee3697c9a5e7fb6bd0 upstream. We were computing the size of the import buffer based on the digest size but the 318 and 224 byte variants use 512 and 256 bytes internal state sizes respectfully, thus causing the import buffer to overrun. Fix it by using the right sizes. Signed-off-by: Gilad Ben-Yossef Cc: stable@vger.kernel.org # v4.19+ Signed-off-by: Herbert Xu Signed-off-by: Greg Kroah-Hartman --- drivers/crypto/ccree/cc_hash.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/crypto/ccree/cc_hash.c +++ b/drivers/crypto/ccree/cc_hash.c @@ -1639,7 +1639,7 @@ static struct cc_hash_template driver_ha .setkey = cc_hash_setkey, .halg = { .digestsize = SHA224_DIGEST_SIZE, - .statesize = CC_STATE_SIZE(SHA224_DIGEST_SIZE), + .statesize = CC_STATE_SIZE(SHA256_DIGEST_SIZE), }, }, .hash_mode = DRV_HASH_SHA224, @@ -1666,7 +1666,7 @@ static struct cc_hash_template driver_ha .setkey = cc_hash_setkey, .halg = { .digestsize = SHA384_DIGEST_SIZE, - .statesize = CC_STATE_SIZE(SHA384_DIGEST_SIZE), + .statesize = CC_STATE_SIZE(SHA512_DIGEST_SIZE), }, }, .hash_mode = DRV_HASH_SHA384, From patchwork Mon May 20 12:14:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 164629 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp239109ili; Mon, 20 May 2019 05:42:23 -0700 (PDT) X-Google-Smtp-Source: APXvYqyyUxkynRkVkqMD2vfMi/BuURdDebycaWczCMTyGGtzf64Bseo5J1IDzw4+aa/kPq4+sGzU X-Received: by 2002:a17:902:b492:: with SMTP id y18mr69980856plr.96.1558356143333; Mon, 20 May 2019 05:42:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558356143; cv=none; d=google.com; s=arc-20160816; b=T1T0hZ4f1aA7huVTzBb6EKp6qiiNlQ0OlGi37mr1Zq7WcyJ+naFKxz+QUTHQRhIfck acyLTrdQmtUWlEsV137f0Hcbs3aapfHH04m2dIpqlAjA+DA5xKSHV270Cfe7s+iQ8Upf 4f5tlsH11wBXj+EMsgZfy3lULJfA2xIz/OG1wuKLpcZfTPTeZuR9LwaL1zF60WrgTvWY S2D1bql6JpUp2wS+z2RHeu/xNgaszNbGODQDUCnNdlubp5iBgt+KRXr7rvzWvpZPVN2I i3nvSqcvzg+Z/Xl4ucTCSpeDphmGAj2klRYpp73bIRsxmh6IzDelaQBM2e+zMTd7vOK4 AC+Q== 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=MMF6Y+gg+sB1EwkDh/AigBgSVFaxZkCYkwOOELsu30U=; b=ho7hg/xkqY3pm6yEzuFH/awtqt74bofmViDAq4M8aBGYGDe8N+dZa48qsDD9meu+3j 6rBd2cxTtx5e34wTibE7sSIIiGLA9qJJOMElVLR2I5f/fDX7tAMgP6rjIsB8RckD4k8W BWQu23NqKabbDT0aVWnS//2JTFwT7SdryaycJ9w3mgP/27B7iRxpD4v7ZxjfekPOEbxv Cz33VcLp5pLWNmrZpNOC7ZwLBHAixM7FjTJ4WfrstGwB8zoUGDmDGNCN7PLbOGse8DGX tnOKSmuC0TRk7Uk5npoHmBkm5MQVBYbJnWasDR/nFgWzPg4w6qS5q1VlSwC2fk9FIElt gHFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="1YOeaN/y"; 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 e11si12396932pgv.569.2019.05.20.05.42.19; Mon, 20 May 2019 05:42:23 -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="1YOeaN/y"; 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 S2391412AbfETMjl (ORCPT + 30 others); Mon, 20 May 2019 08:39:41 -0400 Received: from mail.kernel.org ([198.145.29.99]:50946 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390783AbfETMdr (ORCPT ); Mon, 20 May 2019 08:33:47 -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 D1DCA21479; Mon, 20 May 2019 12:33:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1558355626; bh=ThuQJlJWUbJBxZLkx4DtB+RwKwOeEAz2/qoq9LVWops=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1YOeaN/ySDbdfbMbNsJicDMIq+flf5LiUOznorgb1ouXvoW12usOQnRJRh1k35eDQ jZGn6MTd0L3M3G9WMsz5yUk4MZlUSQ7b9QasZ2u4laKhTkAT4kIM9h3EDSFu70NoB2 lZFh6qdjryV82u9dIVYWRoQb8pD9nBkfQHkl3gDw= 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.1 064/128] crypto: ccree - dont map AEAD key and IV on stack Date: Mon, 20 May 2019 14:14:11 +0200 Message-Id: <20190520115254.120694661@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190520115249.449077487@linuxfoundation.org> References: <20190520115249.449077487@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 e8662a6a5f8f7f2cadc0edb934aef622d96ac3ee upstream. The AEAD authenc key and IVs might be passed to us on stack. Copy it to a slab buffer before mapping to gurantee proper DMA mapping. Signed-off-by: Gilad Ben-Yossef Cc: stable@vger.kernel.org # v4.19+ Signed-off-by: Herbert Xu Signed-off-by: Greg Kroah-Hartman --- drivers/crypto/ccree/cc_aead.c | 11 ++++++++++- drivers/crypto/ccree/cc_buffer_mgr.c | 15 ++++++++++++--- drivers/crypto/ccree/cc_driver.h | 1 + 3 files changed, 23 insertions(+), 4 deletions(-) --- a/drivers/crypto/ccree/cc_aead.c +++ b/drivers/crypto/ccree/cc_aead.c @@ -424,7 +424,7 @@ static int validate_keys_sizes(struct cc /* This function prepers the user key so it can pass to the hmac processing * (copy to intenral buffer or hash in case of key longer than block */ -static int cc_get_plain_hmac_key(struct crypto_aead *tfm, const u8 *key, +static int cc_get_plain_hmac_key(struct crypto_aead *tfm, const u8 *authkey, unsigned int keylen) { dma_addr_t key_dma_addr = 0; @@ -437,6 +437,7 @@ static int cc_get_plain_hmac_key(struct unsigned int hashmode; unsigned int idx = 0; int rc = 0; + u8 *key = NULL; struct cc_hw_desc desc[MAX_AEAD_SETKEY_SEQ]; dma_addr_t padded_authkey_dma_addr = ctx->auth_state.hmac.padded_authkey_dma_addr; @@ -455,11 +456,17 @@ static int cc_get_plain_hmac_key(struct } if (keylen != 0) { + + key = kmemdup(authkey, keylen, GFP_KERNEL); + if (!key) + return -ENOMEM; + key_dma_addr = dma_map_single(dev, (void *)key, keylen, DMA_TO_DEVICE); if (dma_mapping_error(dev, key_dma_addr)) { dev_err(dev, "Mapping key va=0x%p len=%u for DMA failed\n", key, keylen); + kzfree(key); return -ENOMEM; } if (keylen > blocksize) { @@ -542,6 +549,8 @@ static int cc_get_plain_hmac_key(struct if (key_dma_addr) dma_unmap_single(dev, key_dma_addr, keylen, DMA_TO_DEVICE); + kzfree(key); + return rc; } --- a/drivers/crypto/ccree/cc_buffer_mgr.c +++ b/drivers/crypto/ccree/cc_buffer_mgr.c @@ -560,6 +560,7 @@ void cc_unmap_aead_request(struct device if (areq_ctx->gen_ctx.iv_dma_addr) { dma_unmap_single(dev, areq_ctx->gen_ctx.iv_dma_addr, hw_iv_size, DMA_BIDIRECTIONAL); + kzfree(areq_ctx->gen_ctx.iv); } /* Release pool */ @@ -664,19 +665,27 @@ static int cc_aead_chain_iv(struct cc_dr struct aead_req_ctx *areq_ctx = aead_request_ctx(req); unsigned int hw_iv_size = areq_ctx->hw_iv_size; struct device *dev = drvdata_to_dev(drvdata); + gfp_t flags = cc_gfp_flags(&req->base); int rc = 0; if (!req->iv) { areq_ctx->gen_ctx.iv_dma_addr = 0; + areq_ctx->gen_ctx.iv = NULL; goto chain_iv_exit; } - areq_ctx->gen_ctx.iv_dma_addr = dma_map_single(dev, req->iv, - hw_iv_size, - DMA_BIDIRECTIONAL); + areq_ctx->gen_ctx.iv = kmemdup(req->iv, hw_iv_size, flags); + if (!areq_ctx->gen_ctx.iv) + return -ENOMEM; + + areq_ctx->gen_ctx.iv_dma_addr = + dma_map_single(dev, areq_ctx->gen_ctx.iv, hw_iv_size, + DMA_BIDIRECTIONAL); if (dma_mapping_error(dev, areq_ctx->gen_ctx.iv_dma_addr)) { dev_err(dev, "Mapping iv %u B at va=%pK for DMA failed\n", hw_iv_size, req->iv); + kzfree(areq_ctx->gen_ctx.iv); + areq_ctx->gen_ctx.iv = NULL; rc = -ENOMEM; goto chain_iv_exit; } --- a/drivers/crypto/ccree/cc_driver.h +++ b/drivers/crypto/ccree/cc_driver.h @@ -168,6 +168,7 @@ struct cc_alg_template { struct async_gen_req_ctx { dma_addr_t iv_dma_addr; + u8 *iv; enum drv_crypto_direction op_type; }; From patchwork Mon May 20 12:14:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 164624 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp231579ili; Mon, 20 May 2019 05:34:59 -0700 (PDT) X-Google-Smtp-Source: APXvYqw99CYGirZXgEouFdlocmvazv/4DAZkxqtfHA1Bvzl0fhdaWQuVpBcQD2jqOzg998S6bjPL X-Received: by 2002:a65:640c:: with SMTP id a12mr13125158pgv.1.1558355698983; Mon, 20 May 2019 05:34:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558355698; cv=none; d=google.com; s=arc-20160816; b=zKDjfs91PmHzY6Yr4+nnxBHSgQEkvFDd87kva1nkf5rVnEQjd+dMR7TwcexbxOV7p5 vymT9mEz6XXWvPxl3yP2muqfJIYgqw6ypRIg20vschtVlJAZF4x0wPe2nZtFoQKEsbcE z7Hsdpxd3Iij4PyL+0ShR83oUXCF88HfoVIhIb47gfjhuFI+0puIEuneUsztMyojudlF unqf1zDqo/mRcuC8S+DRMCHEHP+XcMKy2cekFB+b49L6m+7tzdrco8WFIi4QUocQneFF ouL0QcJpMoSngkJAXvjA+sl+HZ5RWSsXX5ubx1q/YPElNIVv7TsAGIr5kzuhkv/dFYeo CVdA== 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=MQsQd7JjODRrsK+dQeyghBZyBB4P818m4ncJkixtdw8=; b=fgJqejvZudUUGCL0T94DY5vncGVvJlzeV/HyKODwfyBChpUTMiUQ0oxHzsh76gTVWd 2aslHFXzPQ8qJCC3+edQwVSOEGpnVGQpj9KFXnb0Qh6uXtdMZ+4QBaXYsCQjlgO3Ag2l d408YlJnQFgENZC1lpcaavUUSFmW6yHakjdIoZUvhMWgYws2Z/Q67cjTpCUXmmhxF1Ak +KTaNwMR8n6gayawKRdT05qRzrI+fdVuGiELo1GoqhOnSbEfIkoBnQyBWQfn63gixxs8 xH/XNeshOAXdZ4U6bQpweOCKjCXjx9ejbVwtHKB3HKKjGMHx1bmGvzLRLm5BRyE4Kl5c wSNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=w+pOkUbp; 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 e11si12396932pgv.569.2019.05.20.05.34.55; Mon, 20 May 2019 05:34:58 -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=w+pOkUbp; 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 S2390823AbfETMdy (ORCPT + 30 others); Mon, 20 May 2019 08:33:54 -0400 Received: from mail.kernel.org ([198.145.29.99]:51014 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390807AbfETMdw (ORCPT ); Mon, 20 May 2019 08:33:52 -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 22295204FD; Mon, 20 May 2019 12:33:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1558355631; bh=N9QFeO4yQVMQCWzkv0CVm3igV/vAF6zg1t8BEEZGIbY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=w+pOkUbpOVhMb+J/2Q+eKdsE7FBJhDA10aLQhUnQpMZ8UUTsfnw9Dz9D4pCJHfyrq 8WPUZj+7uBRrMWjqLCJzxB2QjtjeniMMsdB9TG6vJXGw9JaAuC7cYOAzMLkDXT8XmS cGBm2Zig3rNvHvEBZeTyxDzGjBlskFloolQ7ufFc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ofir Drang , Gilad Ben-Yossef , Herbert Xu Subject: [PATCH 5.1 066/128] crypto: ccree - HOST_POWER_DOWN_EN should be the last CC access during suspend Date: Mon, 20 May 2019 14:14:13 +0200 Message-Id: <20190520115254.272856830@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190520115249.449077487@linuxfoundation.org> References: <20190520115249.449077487@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: Ofir Drang commit 3499efbeed39d114873267683b9e776bcb34b058 upstream. During power management suspend the driver need to prepare the device for the power down operation and as a last indication write to the HOST_POWER_DOWN_EN register which signals to the hardware that The ccree is ready for power down. Signed-off-by: Ofir Drang Signed-off-by: Gilad Ben-Yossef Cc: stable@vger.kernel.org # v4.19+ Signed-off-by: Herbert Xu Signed-off-by: Greg Kroah-Hartman --- drivers/crypto/ccree/cc_pm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/crypto/ccree/cc_pm.c +++ b/drivers/crypto/ccree/cc_pm.c @@ -25,13 +25,13 @@ int cc_pm_suspend(struct device *dev) int rc; dev_dbg(dev, "set HOST_POWER_DOWN_EN\n"); - cc_iowrite(drvdata, CC_REG(HOST_POWER_DOWN_EN), POWER_DOWN_ENABLE); rc = cc_suspend_req_queue(drvdata); if (rc) { dev_err(dev, "cc_suspend_req_queue (%x)\n", rc); return rc; } fini_cc_regs(drvdata); + cc_iowrite(drvdata, CC_REG(HOST_POWER_DOWN_EN), POWER_DOWN_ENABLE); cc_clk_off(drvdata); return 0; } From patchwork Mon May 20 12:14:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 164627 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp238884ili; Mon, 20 May 2019 05:42:09 -0700 (PDT) X-Google-Smtp-Source: APXvYqzACKbC5+BvMHO7Ni03EMuIljhxygJwW9SEtMMnhtJ+vTZ1lLjkzhN9SiIsF4ux6SkC+GNV X-Received: by 2002:a62:e217:: with SMTP id a23mr35333567pfi.128.1558356129374; Mon, 20 May 2019 05:42:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558356129; cv=none; d=google.com; s=arc-20160816; b=dncygAuwxADWmy8/nwRUtdgYwyQmFHJWBPKp1oZ7O1tP3PQ8twwwMKHMRc/FjEfio8 fcIZl2dvggFsrPxAulXzyf3yqLIj/LdqIZfPxB37Xt166ylnME8n9BIqGmrkBagveWMU W075rGuCCdja+W4NgC2riRgaYbTSLWrgueLRiaSWwWwISVVLCXXN5Sx2UaLNm5TMW7ym 2KOnycvDJfLLPkM5hXqb+xM2jVxvnuHaf7c9Aax8Z7dYaINd8a2rO3+9JrBoGz2VHDpy uUOvJ+hf7/e/+MJNqH4eQN1aGkH6p6BGRssuhvgMIb1KVmn5Z3pwF8AbppZ0ESKIaAnq Fhcg== 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=qqwj2dkUx+ur/a/tog/DfPiMH4JjlCcX+Gpm0wKqRvM=; b=HRXfyWtwSjgis4dTsWFnC5+OhH15LWHNb5Qgkec+X/jfDck5DwNLxZwr8xQNVDbTLB UGAcBVQ+eOOPGexZ5QNOBr7Md6BhFPsDxePA5HmB7iGnYpY67fH7ni1FdHGcjwD7IJWh WqoXLYCwgseei4V/ZWPHls0Ywov5HWQKg6Tp3Psf9WhvYGAx7I8cPXKUnVGr0xMDUyjd 1zJ7Erueq2czNwI/0cUzzOMHy6GH2Ti6qh4WlurtiUs1snSlhWfVE7ZC9P5Gi04LSywm bL1k4mXnLL/LgPekfAgN3OxULqjjtizUZrCV/cqMNpJDNhkpT1FJsxMG1lwtp0APrce4 RfLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=orcuSauu; 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 e11si12396932pgv.569.2019.05.20.05.42.05; Mon, 20 May 2019 05:42:09 -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=orcuSauu; 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 S2391385AbfETMjb (ORCPT + 30 others); Mon, 20 May 2019 08:39:31 -0400 Received: from mail.kernel.org ([198.145.29.99]:51140 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390464AbfETMd5 (ORCPT ); Mon, 20 May 2019 08:33:57 -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 6EC1A21479; Mon, 20 May 2019 12:33:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1558355636; bh=UH6JkK6X0kuRS9HGzftnJ0yrDm0rxbG8gjI3mS3bbjs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=orcuSauuii3WoxygER1rmdg9cUHpBE7G28LruDxZ0GE6kWmQL5gh7vJNS0ZOLCvW5 Bp86g67OWqfbdS8rG4uSQC8o/VDfIXa3BsyeW+jeQqQpuyC2SdlM+NKDOC37Im+kIv YToGMKv2HWPZtoW5qc5UAyCTtLxy/xuwC0tW/6/c= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ofir Drang , Gilad Ben-Yossef , Herbert Xu Subject: [PATCH 5.1 067/128] crypto: ccree - add function to handle cryptocell tee fips error Date: Mon, 20 May 2019 14:14:14 +0200 Message-Id: <20190520115254.337524887@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190520115249.449077487@linuxfoundation.org> References: <20190520115249.449077487@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: Ofir Drang commit 897ab2316910a66bb048f1c9cefa25e6a592dcd7 upstream. Adds function that checks if cryptocell tee fips error occurred and in such case triggers system error through kernel panic. Change fips function to use this new routine. Signed-off-by: Ofir Drang Signed-off-by: Gilad Ben-Yossef Cc: stable@vger.kernel.org # v4.19+ Signed-off-by: Herbert Xu Signed-off-by: Greg Kroah-Hartman --- drivers/crypto/ccree/cc_fips.c | 23 +++++++++++++++-------- drivers/crypto/ccree/cc_fips.h | 2 ++ 2 files changed, 17 insertions(+), 8 deletions(-) --- a/drivers/crypto/ccree/cc_fips.c +++ b/drivers/crypto/ccree/cc_fips.c @@ -72,20 +72,28 @@ static inline void tee_fips_error(struct dev_err(dev, "TEE reported error!\n"); } +/* + * This function check if cryptocell tee fips error occurred + * and in such case triggers system error + */ +void cc_tee_handle_fips_error(struct cc_drvdata *p_drvdata) +{ + struct device *dev = drvdata_to_dev(p_drvdata); + + if (!cc_get_tee_fips_status(p_drvdata)) + tee_fips_error(dev); +} + /* Deferred service handler, run as interrupt-fired tasklet */ static void fips_dsr(unsigned long devarg) { struct cc_drvdata *drvdata = (struct cc_drvdata *)devarg; - struct device *dev = drvdata_to_dev(drvdata); - u32 irq, state, val; + u32 irq, val; irq = (drvdata->irq & (CC_GPR0_IRQ_MASK)); if (irq) { - state = cc_ioread(drvdata, CC_REG(GPR_HOST)); - - if (state != (CC_FIPS_SYNC_TEE_STATUS | CC_FIPS_SYNC_MODULE_OK)) - tee_fips_error(dev); + cc_tee_handle_fips_error(drvdata); } /* after verifing that there is nothing to do, @@ -113,8 +121,7 @@ int cc_fips_init(struct cc_drvdata *p_dr dev_dbg(dev, "Initializing fips tasklet\n"); tasklet_init(&fips_h->tasklet, fips_dsr, (unsigned long)p_drvdata); - if (!cc_get_tee_fips_status(p_drvdata)) - tee_fips_error(dev); + cc_tee_handle_fips_error(p_drvdata); return 0; } --- a/drivers/crypto/ccree/cc_fips.h +++ b/drivers/crypto/ccree/cc_fips.h @@ -18,6 +18,7 @@ int cc_fips_init(struct cc_drvdata *p_dr void cc_fips_fini(struct cc_drvdata *drvdata); void fips_handler(struct cc_drvdata *drvdata); void cc_set_ree_fips_status(struct cc_drvdata *drvdata, bool ok); +void cc_tee_handle_fips_error(struct cc_drvdata *p_drvdata); #else /* CONFIG_CRYPTO_FIPS */ @@ -30,6 +31,7 @@ static inline void cc_fips_fini(struct c static inline void cc_set_ree_fips_status(struct cc_drvdata *drvdata, bool ok) {} static inline void fips_handler(struct cc_drvdata *drvdata) {} +static inline void cc_tee_handle_fips_error(struct cc_drvdata *p_drvdata) {} #endif /* CONFIG_CRYPTO_FIPS */ From patchwork Mon May 20 12:14:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 164625 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp231836ili; Mon, 20 May 2019 05:35:12 -0700 (PDT) X-Google-Smtp-Source: APXvYqx0lyRyfw77PiFSbV+Pn2lF4NeYBo7kqpyOZafrENJG3SgIkhlQ7yRNsq7HUMepQrOFeH3w X-Received: by 2002:a17:902:d706:: with SMTP id w6mr28209438ply.261.1558355712282; Mon, 20 May 2019 05:35:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558355712; cv=none; d=google.com; s=arc-20160816; b=VIjcPM6IjQIxdgo9NcWZCRAH5/qUv+/VJ3SzjJgG8Tqv6+dGVl8zwepsjcd9G6oUDU 1rygGqXWRsz3CSHwPkCm6tPZrn2BHU9yuclQjX1R5t6e+bzwkun8354LFYCFV07thQTd 0GfM3F3jmfIhK3SRtFY/tdpftZgclUbokiGPyXNHBH5NVMXAbEhz9ZfsiNgTSCYj5UAb e3q0zG1BisMLOm0SJhhEuNpr3DHYCtiBriatV5cYCaa8eboVF2TFL8p0W7c1nDnhGhdb iEdhvglAZUqtyGKKkI/jCh8Bib0x7YCFG8tggyI+CRSdHNQhreEnP7xlMiemYkJ9Is7K Zy0A== 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=Bsr5lnxGn3aaW5Bh5tHhpU2uotZZ/yJORIJIhWro+k8=; b=IhbMvEA++Pnwu2OUbP5/t+gmI2Jf7TdYYSAjkxkVrycwi8ZjCZxjZKWdXNLzun1J6v GsonOjeaUOlFxn1+Vpx0lcMvoxy2070HRH12vyDAE/Eb5Lu7DQdiG7BrRiEIUaZoKZe7 ht0mEVtSyJyaoFztdIr1T+RS+GwtjU9gQi66l/oTsS8TfUSVUzrL7j3LOoKBX8RmZxbu OB90IxVPg5RzYk+ZiHoWpfbPlbA+/K9ofHN594RFAeQLi/4jy6KcFofbcO7ZT6ud7+od KrmXaRD09wUviWATY2/kBvSy1Q6pmiUYxkoB5iAwHPBsxMvArpKMWm/R1gwKXoTkbEo9 N4JQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="fi/ZjgZp"; 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 e11si12396932pgv.569.2019.05.20.05.35.08; Mon, 20 May 2019 05:35:12 -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="fi/ZjgZp"; 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 S2390843AbfETMeE (ORCPT + 30 others); Mon, 20 May 2019 08:34:04 -0400 Received: from mail.kernel.org ([198.145.29.99]:51178 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733307AbfETMeA (ORCPT ); Mon, 20 May 2019 08:34:00 -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 4AE07204FD; Mon, 20 May 2019 12:33:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1558355639; bh=evbFVzhLxEg4SbCoKYUaCDJhdyPgsuUfMr8WxKWYoSI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fi/ZjgZpIa5N2zbyDfBAc5c93bbWdlggeESZy5O5RPtlPEGuNWbWHkUaxSes2wfZM ApaqpiIL6kWMukNSIlKa2JKixJO2SAodo8qC7TCw7ZEMglpR4U0yb3VD+RJBCwijxs wu4OGQ0gZ0xsY0EOZ+t1N6Yk1K88XTqgRQGT0M5o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ofir Drang , Gilad Ben-Yossef , Herbert Xu Subject: [PATCH 5.1 068/128] crypto: ccree - handle tee fips error during power management resume Date: Mon, 20 May 2019 14:14:15 +0200 Message-Id: <20190520115254.401097564@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190520115249.449077487@linuxfoundation.org> References: <20190520115249.449077487@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: Ofir Drang commit 7138377ce10455b7183c6dde4b2c51b33f464c45 upstream. in order to support cryptocell tee fips error that may occurs while cryptocell ree is suspended, an cc_tee_handle_fips_error call added to the cc_pm_resume function. Signed-off-by: Ofir Drang Signed-off-by: Gilad Ben-Yossef Cc: stable@vger.kernel.org # v4.19+ Signed-off-by: Herbert Xu Signed-off-by: Greg Kroah-Hartman --- drivers/crypto/ccree/cc_pm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/drivers/crypto/ccree/cc_pm.c +++ b/drivers/crypto/ccree/cc_pm.c @@ -11,6 +11,7 @@ #include "cc_ivgen.h" #include "cc_hash.h" #include "cc_pm.h" +#include "cc_fips.h" #define POWER_DOWN_ENABLE 0x01 #define POWER_DOWN_DISABLE 0x00 @@ -50,12 +51,13 @@ int cc_pm_resume(struct device *dev) } cc_iowrite(drvdata, CC_REG(HOST_POWER_DOWN_EN), POWER_DOWN_DISABLE); - rc = init_cc_regs(drvdata, false); if (rc) { dev_err(dev, "init_cc_regs (%x)\n", rc); return rc; } + /* check if tee fips error occurred during power down */ + cc_tee_handle_fips_error(drvdata); rc = cc_resume_req_queue(drvdata); if (rc) {