Received: by 10.223.176.46 with SMTP id f43csp1056433wra; Fri, 26 Jan 2018 11:06:12 -0800 (PST) X-Google-Smtp-Source: AH8x227B5Gzsy8FVMS+zWIhyqxAQ8ilDYK6uG+gUsvL4B0mckN3czTV8sYgeZuYb6VgNQELFu4h7 X-Received: by 10.99.160.88 with SMTP id u24mr16266620pgn.122.1516993572632; Fri, 26 Jan 2018 11:06:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516993572; cv=none; d=google.com; s=arc-20160816; b=mfdnC4Xo6uG+sSQOsij4nroa1bvq53iFr/8ra66iRgf2HaY/ITEg9E9rfnvFb0Ui2F /MsAEvET3JW0kc1aYvPAU/X43+2e1OIOGHS2Twl6hlFNJR1VUU0uUPvyFpQDUVDB54WM 02vL92c8nRwo7SOkb+41y7pdc0LlE20DqkFnWE/Q/soKUuZNGTv2/IUzJxtGXVOU+UrX zxZbloHCDklMgaic9gAuThiEhawYisAD17J7IxHZUriIr3mh/7K+cPY7ISuq13WM8H2Y +fmUD3tOrUYLHltVJ2mxb4hB2ztH70tLbbNR3F6OdD/ApkpqIlVOSglSaeF2wDnZeSw5 YLDQ== 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=/8OKyKXFl8eaAcY5CwxPGK8XXyEVRhBmohFRn1e6/9w=; b=YBGs3tAd18t/rTPax1nzMk+CoS/IKbhhS5nxgD7TM+7Pp9DLNinXWqm/fv6KfbYsQu Vu2Vwd+46Nu2WZoMnlzSIdnonUwJUUN0JGlICwvd83YoiQfsKvfNEePFG+vrQsRsbz1E AfbAn8js8o14jDPzMkziV+30Y6esvBTCcMOR3P3Ou5B1kC+4PL6t1hiMDs6j4P3n/RDt vzfJX/GYiPBSioYgNoHprSRgne8KPcgUrQPXlkF2DFuHJrwjC3IKs2khNxyNYckiHuUm q8uehwimHo8d4VQ5KQ843I9LdBREaPBKSJUWA/tfEZkqjwgOqGGhPZowUJLI+59z0XA5 /OcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nexus-software-ie.20150623.gappssmtp.com header.s=20150623 header.b=Y/moxpqA; 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 w3si3318907pgb.739.2018.01.26.11.05.58; Fri, 26 Jan 2018 11:06:12 -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=Y/moxpqA; 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 S1752725AbeAZTF0 (ORCPT + 99 others); Fri, 26 Jan 2018 14:05:26 -0500 Received: from mail-wm0-f65.google.com ([74.125.82.65]:37890 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752590AbeAZTFT (ORCPT ); Fri, 26 Jan 2018 14:05:19 -0500 Received: by mail-wm0-f65.google.com with SMTP id 141so23024722wme.3 for ; Fri, 26 Jan 2018 11:05:18 -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=/8OKyKXFl8eaAcY5CwxPGK8XXyEVRhBmohFRn1e6/9w=; b=Y/moxpqAE8AhEjWoE7hNmbYWpaSmfZV28GzFaZW7VHEljOkBOn7G5uJmqMt9Ny6/mZ moI/W2fQ/Lkma+kHQvticVJDwhhTPtgHhJbIu/pIg7/UKSVEdXdSbD8cIzXpaRXOPtA8 SAjMJ1FiYrNclS1boCJG/At2ugGk342zP9WExANjukbJhWEOpaC5ew4mFXP2wAmtyXs/ Ol8FhLTmxzgmq6021nz7mwsS8kQblIUDvfGR961aQ0I6PS06F1xdGP1rzYznJy7yNseF 4lm2apTlTNgf3swLMmvitiS3WylsNZC/Bo14stEROK5F3sQ9Ho4GshJzkUSSzsv8rVMT Aiyg== 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=/8OKyKXFl8eaAcY5CwxPGK8XXyEVRhBmohFRn1e6/9w=; b=bLHQw2xCG6v3VFzu37bSwTU8hqIui6x7g5W5L4ENfCYcOKcQCpHt349DinYONngaku nb2wLTmJOFGYODI+Ka+1OD/LZX2LXPsmJXXgxd0pmAAiT8QV6Hx4moAZVwSOqWS5CyB3 27T21ckuB20KSxnfPuO7C0hqnjR/IlVaAWEX5vxeMaZGRHaAT+7tFnViYYtyAoAXSpFB hkuOWNOCtxcnUfU8z5jWTKaj7EhAh4YORJnS/PhZhqY3ObTy163TuVNAH8N4VkMzn3GR vD+F5Nggagqoa2d6LlCQoVEjFn6S8iWHrF4uHDYHz4vsEjyehCYSi4XY5rzOyWZ+S43+ /CPQ== X-Gm-Message-State: AKwxytcN0bPgTC8vrVoYBAlPa8rNWgQrTd/IJ6iuqcE4Dh3egenV92QA VKyfzINNwVRCXdKZXS+NSfE3Uw== X-Received: by 10.80.244.23 with SMTP id r23mr34654029edm.2.1516993517070; Fri, 26 Jan 2018 11:05:17 -0800 (PST) Received: from localhost.localdomain ([109.255.42.2]) by smtp.gmail.com with ESMTPSA id k12sm2719836edl.86.2018.01.26.11.05.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 26 Jan 2018 11:05:16 -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, herbert@gondor.apana.org.au, davem@davemloft.net, lukas.auer@aisec.fraunhofer.de, rui.silva@linaro.org, ryan.harkin@linaro.org, Bryan O'Donoghue , "# 4 . 12+" Subject: [RESEND PATCH v2 2/5] crypto: caam: Fix endless loop when RNG is already initialized Date: Fri, 26 Jan 2018 19:04:58 +0000 Message-Id: <1516993501-29646-3-git-send-email-pure.logic@nexus-software.ie> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1516993501-29646-1-git-send-email-pure.logic@nexus-software.ie> References: <1516993501-29646-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: Herbert Xu 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