Received: by 2002:a05:7412:40d:b0:e2:908c:2ebd with SMTP id 13csp899884rdf; Tue, 21 Nov 2023 22:57:53 -0800 (PST) X-Google-Smtp-Source: AGHT+IHAFNWVKeituw30IcRppRFkFli40VegGshzlp4ToO5Wps1iNKKGVsORWsrHlV14Vr4PUyqC X-Received: by 2002:a05:6a20:9144:b0:187:d93f:b0fa with SMTP id x4-20020a056a20914400b00187d93fb0famr1694344pzc.27.1700636273056; Tue, 21 Nov 2023 22:57:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700636273; cv=none; d=google.com; s=arc-20160816; b=SmzrT/3meIWJFAuqjg7xfkzJ46ExgaEv72u4hRMJ4wpiEjRuthoq5PSJ/5GVOrbW/M g+V0aGY7IxAGkbNbSWlmvMZEtYTzRIfkJoe0a5GTtpIufU21XvDhQBuJFtS7W/z/0aei 8MEdCozrdYGJmjwwJky2DPbh7r3RA3HnwBMTnJyB47H9OTdz++l6VyFvCVXviLiPiFA6 BL02kRpB9k9QW3lDn0vBvFVvenbjB/bOuQdQ3EvktmTcIfjeV1+5IldpHsVnItqc0Jpm R504OA6LgS13k6222RdMqGEkarFni5L5e3IBRS925vw4Og/B/bz/jqdeAo0Koy/3KzGM Bpsg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=UUf0sol4MXR6E29PQDMqjrVE54IEFrYzEFPblgiH5pk=; fh=vMjwTtd/Sy44L6errYKZtIdj8y17uOf9GzbaF9TEr8c=; b=JbKg47Yda5JNVbKH+twMXx89QyWUTlbkA1LVlWfPEIHKflTGyJ15DyHeXOfLXjLke8 iYQDhm0VzPYJTe4kR4kI/DKIEr2xgDlMn/grLfuk3ynXgVv/4p55bE37GjMS2Z+m6mkN 8Br2UfbzboBYceNEFXGu1DD9vaxuvjB/vVcUqilwJt7JG1NQcEvvkXm7DSAEzYQHkCrv rbHHU58zNRGvA94O6S5++jtihGyJSK9NWzmIQFUD5E62J9v30bA8V6m5bOIVy+R0Pa4N CnPak04VDep42/Zg0aFkdAF7Ein9xfKiqCMAq2awn3RPd+cjv/Cvnjse8o9VMQ5EgfG7 cEFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alliedtelesis.co.nz header.s=mail181024 header.b=ZRT9wru4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=REJECT dis=NONE) header.from=alliedtelesis.co.nz Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id 196-20020a6301cd000000b00589fcc39ef1si12076073pgb.365.2023.11.21.22.57.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Nov 2023 22:57:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@alliedtelesis.co.nz header.s=mail181024 header.b=ZRT9wru4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=REJECT dis=NONE) header.from=alliedtelesis.co.nz Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id C05F580FCE1B; Tue, 21 Nov 2023 22:57:50 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234830AbjKVG5g (ORCPT + 99 others); Wed, 22 Nov 2023 01:57:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43854 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234740AbjKVG5e (ORCPT ); Wed, 22 Nov 2023 01:57:34 -0500 Received: from gate2.alliedtelesis.co.nz (gate2.alliedtelesis.co.nz [202.36.163.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 20EDC1AC for ; Tue, 21 Nov 2023 22:57:29 -0800 (PST) Received: from svr-chch-seg1.atlnz.lc (mmarshal3.atlnz.lc [10.32.18.43]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by gate2.alliedtelesis.co.nz (Postfix) with ESMTPS id AAF2A2C0240; Wed, 22 Nov 2023 19:57:26 +1300 (NZDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alliedtelesis.co.nz; s=mail181024; t=1700636246; bh=UUf0sol4MXR6E29PQDMqjrVE54IEFrYzEFPblgiH5pk=; h=From:To:Cc:Subject:Date:From; b=ZRT9wru4qojBDGFtQ6OJYF4V6fOwr3mXK2BvNqzAs3NuL+vLdPVsf1aQ7WT9pSJ1B qRnqeJmCBDWmx9vrxiBS0gTElbbvJsSxExzRHyU9AUudarO/07ngML9UzvvNcCWSQh YrBNaxgcMdT1sQTNa17YnsTn5i6davGXCIAL2WxLnK5ekk/qWZJbdJHZAwU4Rtsa/C fy22V1T3NgMaDaY44mR0fDVsB/qZ6XaU1IZnBkcYwzSK4dLT6iVHgj43b5f5CFeK7f tyw5CmkC134DRSNOMaL32RHGJpEs48zsgVX2jXt0h2xxZ6ldrbF++C8YGrloGgY3K2 RjvIrkIGmEmzQ== Received: from pat.atlnz.lc (Not Verified[10.32.16.33]) by svr-chch-seg1.atlnz.lc with Trustwave SEG (v8,2,6,11305) id ; Wed, 22 Nov 2023 19:57:26 +1300 Received: from angga-dl.ws.atlnz.lc (angga-dl.ws.atlnz.lc [10.33.22.36]) by pat.atlnz.lc (Postfix) with ESMTP id 74B5313EDD7; Wed, 22 Nov 2023 19:57:26 +1300 (NZDT) Received: by angga-dl.ws.atlnz.lc (Postfix, from userid 1025) id 6F0DD5639F4; Wed, 22 Nov 2023 19:57:26 +1300 (NZDT) From: Hermin Anggawijaya To: peterhuewe@gmx.de, jarkko@kernel.org, jgg@ziepe.ca Cc: linux-integrity@vger.kernel.org, linux-kernel@vger.kernel.org, Hermin Anggawijaya Subject: [PATCH] tpm: Start the tpm2 before running a self test. Date: Wed, 22 Nov 2023 19:55:28 +1300 Message-ID: <20231122065528.1049819-1-hermin.anggawijaya@alliedtelesis.co.nz> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SEG-SpamProfiler-Analysis: v=2.3 cv=AZXP4EfG c=1 sm=1 tr=0 a=KLBiSEs5mFS1a/PbTCJxuA==:117 a=BNY50KLci1gA:10 a=rJFBBZ_W6pJUP7hz3OAA:9 a=ZXulRonScM0A:10 a=zZCYzV9kfG8A:10 X-SEG-SpamProfiler-Score: 0 x-atlnz-ls: pat X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Tue, 21 Nov 2023 22:57:50 -0800 (PST) Before sending a command to attempt the self test, the TPM may need to be started, otherwise the self test returns TPM2_RC_INITIALIZE value causing a log as follows: "tpm tpm0: A TPM error (256) occurred attempting the self test". Signed-off-by: Hermin Anggawijaya --- drivers/char/tpm/tpm2-cmd.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/char/tpm/tpm2-cmd.c b/drivers/char/tpm/tpm2-cmd.c index 93545be190a5..0530f3b5f86a 100644 --- a/drivers/char/tpm/tpm2-cmd.c +++ b/drivers/char/tpm/tpm2-cmd.c @@ -737,15 +737,15 @@ int tpm2_auto_startup(struct tpm_chip *chip) if (rc) goto out; =20 + rc =3D tpm2_startup(chip); + if (rc && rc !=3D TPM2_RC_INITIALIZE) + goto out; + rc =3D tpm2_do_selftest(chip); if (rc && rc !=3D TPM2_RC_INITIALIZE) goto out; =20 if (rc =3D=3D TPM2_RC_INITIALIZE) { - rc =3D tpm2_startup(chip); - if (rc) - goto out; - rc =3D tpm2_do_selftest(chip); if (rc) goto out; --=20 2.43.0