Received: by 10.223.176.5 with SMTP id f5csp698874wra; Tue, 30 Jan 2018 18:04:04 -0800 (PST) X-Google-Smtp-Source: AH8x225EgqEiQH29rBanehTkZLCplAYap9Lh95UrcAwvSs7uitYjQ3ceunEeeTN6Hba4nLYy1XSf X-Received: by 10.98.141.199 with SMTP id p68mr30989994pfk.25.1517364244043; Tue, 30 Jan 2018 18:04:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517364244; cv=none; d=google.com; s=arc-20160816; b=FCcFAjVcOqcknBJM9l+0A1ChoqlS31mOvX5/rFGSCI2f1Xf8gwRzuvYtHbvQbszcBV txqKgheIE/Lr0wAFFTKoYv947iSJvmFGwmMbppEkX6kOKvQdVYVdKANTxKjMHc11iIcL Ld38yt1U3+u/Bvdu1MTstsCHn7jDyGHskY40BWCXhSEyIkClnF/AHEnH+eT6r4pP3ZKc ymAWklMuGyMbnL1D9inkiy2CUZ45uLWliBrHjtwSQT4BOcms39bpWx2DjHT7aRsz/nak bQtBTYjPJH6QDcarEFjaIar0ElbYk1GMjH+JZKHCGxPos/YyGacKjinP9g0vjqdVDBcV QoTA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=qwEHLt+8fnZa63P0yVCYlWXoStryIR0m6OA6WzoA0O4=; b=N4KRzqlJeU4+Fp5YDWI3ojAXLg5rnnWZ/Pg78ZFPdl+zTT8QH/imBnYUDC/XVijZh9 +9GmtZSCplAmnzwQoFy9Lq/8gxNYPnsh3GCkqQdjSDd36aBwGS6SSiNM67yiOOBQ+llv GyEeYFkqvXu3g+MQdkyXHgre3K9SCYiZ6blGTjnKP2oWA05PrpBblx+13R6XYN0WilZ4 VguckhL6Dyg0XnlhmBUB/dLCynU4qsydhtkabf3fsZOUXdeUi26MU0pOJUG6p4tKoAH/ BsNWpcbI2mxaNJkVY1fXDUq0HgVmYOlVeAsMDZwrMHxIyATwlMP+XlFy/ml2ZowUJKXD Xb2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nexus-software-ie.20150623.gappssmtp.com header.s=20150623 header.b=AOfE98cd; 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 w70si2711021pgd.382.2018.01.30.18.03.49; Tue, 30 Jan 2018 18:04:04 -0800 (PST) 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=@nexus-software-ie.20150623.gappssmtp.com header.s=20150623 header.b=AOfE98cd; 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 S1753191AbeAaCBy (ORCPT + 99 others); Tue, 30 Jan 2018 21:01:54 -0500 Received: from mail-wm0-f65.google.com ([74.125.82.65]:38992 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752898AbeAaCAp (ORCPT ); Tue, 30 Jan 2018 21:00:45 -0500 Received: by mail-wm0-f65.google.com with SMTP id b21so4868541wme.4 for ; Tue, 30 Jan 2018 18:00:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nexus-software-ie.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=qwEHLt+8fnZa63P0yVCYlWXoStryIR0m6OA6WzoA0O4=; b=AOfE98cdiPDJASFDE9+WPeHbk6SP4tgk2ZSzErPzgT6OROQYcJgiQUDIKsjs2Zti7W Lhf41pJt+J+6i0HxpCaSpMRECfEcfrzP0+Zj0o0sEIxLOxCmVC3uQg5obdi/2UmhmIsy xedQC1zxL0Y2YnZqeKt7qLUrmzc31DMfVuzY4rfPmc7F1bxPLcbwpKQQAXjcNk4ErRFW GG027bzoD2T7xs48X2s9HrZF3ml+brq87iSYfgAOG0SzKESA7rae/29IxZEkw9x/EUtK 0Zl1PsOWjzFUKY7S4uujIwEBCnnDPGsMHmFBa3FB5vC7JrfIvFnJG/1h6N9jjs5u3yMb AQKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=qwEHLt+8fnZa63P0yVCYlWXoStryIR0m6OA6WzoA0O4=; b=F/jfyFCHMjwvvL0qafW/pXraY7MaN03LOrEU98AIcNcff0UuArBBjD7KYjZY1EIPPp XMrimVuNNG9LNzftJbKxxU25cVR77DHwVGeS1ztoouzjSccN8kSAgproMNpjqTurVySr GFbr81rQXrViahJCqqNDfcNb+CxeSkC35Mlbm9m8jKSwjUkwRg/vDx2uMivmFESgIJc7 Ppxxd0JcSDYLFx1VXGgK26P/LMGBly3V24Tdj8Hh6mN4dqBEaR5UnMneU/VDjidvAv+j MwMyR5z4hOhWLTK19USNSw8bSdsyVsyXUX257kvh4Nub4rDMGWUr4N935tc9GfRbyZs2 CasQ== X-Gm-Message-State: AKwxytec5+pqoKc5te0zPrEQes9n6M0qpjBtwz2pEwe+iLRQQLjLCrgN 78aasuLvapOa783J0KXDzyJA7w== X-Received: by 10.80.165.180 with SMTP id a49mr53858790edc.79.1517364044406; Tue, 30 Jan 2018 18:00:44 -0800 (PST) Received: from localhost.localdomain ([109.255.42.2]) by smtp.gmail.com with ESMTPSA id w26sm9030867edw.7.2018.01.30.18.00.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 30 Jan 2018 18:00:43 -0800 (PST) From: Bryan O'Donoghue To: horia.geanta@nxp.com, aymen.sghaier@nxp.com, linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org Cc: fabio.estevam@nxp.com, peng.fan@nxp.com, davem@davemloft.net, lukas.auer@aisec.fraunhofer.de, rui.silva@linaro.org, ryan.harkin@linaro.org, Bryan O'Donoghue , "# 4 . 12+" Subject: [PATCH v3 2/5] crypto: caam: Fix endless loop when RNG is already initialized Date: Wed, 31 Jan 2018 02:00:37 +0000 Message-Id: <1517364040-27607-3-git-send-email-pure.logic@nexus-software.ie> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1517364040-27607-1-git-send-email-pure.logic@nexus-software.ie> References: <1517364040-27607-1-git-send-email-pure.logic@nexus-software.ie> 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 commit 1005bccd7a4a ("crypto: caam - enable instantiation of all RNG4 state handles") introduces a control when incrementing ent_delay which contains the following comment above it: /* * If either SH were instantiated by somebody else * (e.g. u-boot) then it is assumed that the entropy * parameters are properly set and thus the function * setting these (kick_trng(...)) is skipped. * Also, if a handle was instantiated, do not change * the TRNG parameters. */ This is a problem observed when sec_init() has been run in u-boot and and TrustZone is enabled. We can fix this by instantiating all rng state handles in u-boot but, on the Kernel side we should ensure that this non-terminating path is dealt with. Fixes: 1005bccd7a4a ("crypto: caam - enable instantiation of all RNG4 state handles") Reported-by: Ryan Harkin Cc: "Horia Geantă" Cc: Aymen Sghaier Cc: Fabio Estevam Cc: Peng Fan Cc: "David S. Miller" Cc: Lukas Auer Cc: # 4.12+ Signed-off-by: Bryan O'Donoghue --- drivers/crypto/caam/ctrl.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/crypto/caam/ctrl.c b/drivers/crypto/caam/ctrl.c index 98986d3..0a1e96b 100644 --- a/drivers/crypto/caam/ctrl.c +++ b/drivers/crypto/caam/ctrl.c @@ -704,7 +704,10 @@ static int caam_probe(struct platform_device *pdev) ent_delay); kick_trng(pdev, ent_delay); ent_delay += 400; + } else if (ctrlpriv->rng4_sh_init && inst_handles) { + ent_delay += 400; } + /* * if instantiate_rng(...) fails, the loop will rerun * and the kick_trng(...) function will modfiy the -- 2.7.4