From patchwork Thu Nov 24 13:55:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Lino Sanfilippo X-Patchwork-Id: 13055013 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2F565C47088 for ; Thu, 24 Nov 2022 13:57:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230220AbiKXN5E (ORCPT ); Thu, 24 Nov 2022 08:57:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50286 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230229AbiKXN44 (ORCPT ); Thu, 24 Nov 2022 08:56:56 -0500 Received: from mout.gmx.net (mout.gmx.net [212.227.15.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4C0151165B7; Thu, 24 Nov 2022 05:56:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.de; s=s31663417; t=1669298175; bh=tNxzriKju7X09wVvY3INkMxvkZLtq7M5+64P/eal/h4=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=Ays7wa/uQDWJNn3ep6L/CDUcb4ZbmIcHpU+KmoMdvXBjKvK83GtjGEsyvd2qG0sIQ jXqfKpVOGzay688FLBVMEJRiKT2OV7HQ36O5Mkn6qQaVq7Zp7zHHdQX1bM+Qp/Lvjk P3RigZ7k0WeJWKs7u/gRcPTBe6BYpTP1ttD+kc4A5gPfl86ZDL0UcfGAVpnoMIGAn0 lN7SXSViEGsg6FMjYIMhIA1UYbXzdgnY+F3ixchd/bWFnHSKBju6+SvJPwT0XgqAHv bED6lKWY+e10CibuVdHMKIFk2XgZebcpcIpYr+0GoLrqN2ev56/+dqlfI0U51PgQD6 xWyhCwaiuS+ug== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from Venus.speedport.ip ([84.162.7.17]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MQe9s-1oaSkq35Hy-00Nkbe; Thu, 24 Nov 2022 14:56:14 +0100 From: Lino Sanfilippo To: peterhuewe@gmx.de, jarkko@kernel.org, jgg@ziepe.ca Cc: stefanb@linux.vnet.ibm.com, linux@mniewoehner.de, linux-integrity@vger.kernel.org, linux-kernel@vger.kernel.org, jandryuk@gmail.com, pmenzel@molgen.mpg.de, l.sanfilippo@kunbus.com, LinoSanfilippo@gmx.de, lukas@wunner.de, p.rosenberger@kunbus.com Subject: [PATCH v11 14/14] tpm, tpm_tis: Enable interrupt test Date: Thu, 24 Nov 2022 14:55:38 +0100 Message-Id: <20221124135538.31020-15-LinoSanfilippo@gmx.de> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20221124135538.31020-1-LinoSanfilippo@gmx.de> References: <20221124135538.31020-1-LinoSanfilippo@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:xfdO2tuW/H6iYYoumuTl2JI/87L4z6XQerQt8f+R27hsPCrO64Z JwwfgAMboMKyAW+te2wxvETCWMQl9n7oGkgVUgttVuzOj8mppqb7n8fDCtqi3gU1NkCuN4I 8LP8lBZUixMLA2IPpHG9hkg1CYcxXkcQZMY7SDAVvbLzkKFnCKKLNHH388WCpvJ3+iHELmx 06AlFwwV950PY1Vn1fsLQ== UI-OutboundReport: notjunk:1;M01:P0:1X7tueyk1qI=;cI7BBTNCszsaJNj810LcBY0NURn uUcFyWg8EsV5Iz5QF46XdeZhniFC8uMWGw4gXOHAXbzn+q8gbtvSsKKV8eY4hK7RlJnn9sRSg 2Ug/tnVjG+HSmx+j0z5Jii9oE/m7TF16M41Qt4mmYGiWEhWk+pMaiSwHSyHDmNnfGHBtr5QE3 aRmggsoxFYZGsrlmfRojCDjLiASKcpDPrwFqhAmievr+2HXfPCf2ACnTjrqaqgsg75FrQ1UGg dLNV+2O3sfYKhceOcfAkqr7XJtQNksALkXcxOhUOx3mWWGATFG1byaXFGkCac1Zfu4gUSAxiB 23Z7j60SLUP+vqMLOqXMObULp2xJr/DkpYzpFkcnR5FzirSHIqUs7Pz+68xJDCEOODT8zaiwv OTMQlt8uwu6Qu87Mu++czibfjbBzRh9be+rjxCNbMZd3jZoyalXQcLtE3M8H0Nyf8/1JF2sys UKUnrQ9qUyPv/RVFD10Au9zn/+i2+ZEzYFjjUaO2czM2lHwtd89NiKaipU+WRBl3zeZC/iK7o jxgeWrECkTBMowMMQ2ReCtRE6Zbn310uahyYwGzdxlVcAghq/nZcTfz8eu4Ouwx6xwZ7psZgU 2mfmUyLmxOv64aKvNOUIaQvqWdndXP96qZkIRgdzix4FVQBFgCOSwoMH5TzxHuMO+X4fcEbSL lf17I0Cdkj27nlqBJci2Ps12+NnlmUNf7vlshbiXT5R1WUXs/kZBxA54+N9kALIQyKuWScJvf 4Z1fdDg8JMBuw7INIZ1c1a4DxQ4SFJQySCkDa7/+1fxNSn0qMYwT9Cc98EJHoysAjzlSHo8EF Epy6CrgVvaNX5HwwH6bC0WDZ5UqMxEYDPV0H3gOvMA3aKIxoZTcyytTP3wju1pYUPXCHsu3G7 jsW4BqTXcX/5Ot24Wdww+BJCDeUCNE4N+sesPYPF8FkSqU1Qps1oNWjWpnQt56Vd4tkLRWerF 6GPs7ot75nofwZMUtwA+18S73Co= Precedence: bulk List-ID: X-Mailing-List: linux-integrity@vger.kernel.org From: Lino Sanfilippo The test for interrupts in tpm_tis_send() is skipped if the flag TPM_CHIP_FLAG_IRQ is not set. Since the current code never sets the flag initially the test is never executed. Fix this by setting the flag in tpm_tis_gen_interrupt() right after interrupts have been enabled and before the test is executed. Signed-off-by: Lino Sanfilippo Tested-by: Michael Niewöhner Reviewed-by: Jarkko Sakkinen --- drivers/char/tpm/tpm_tis_core.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/char/tpm/tpm_tis_core.c b/drivers/char/tpm/tpm_tis_core.c index 94a2bfb244b3..602ca4bb8e2f 100644 --- a/drivers/char/tpm/tpm_tis_core.c +++ b/drivers/char/tpm/tpm_tis_core.c @@ -789,10 +789,15 @@ static void tpm_tis_gen_interrupt(struct tpm_chip *chip) cap_t cap; int ret; + chip->flags |= TPM_CHIP_FLAG_IRQ; + if (chip->flags & TPM_CHIP_FLAG_TPM2) ret = tpm2_get_tpm_pt(chip, 0x100, &cap2, desc); else ret = tpm1_getcap(chip, TPM_CAP_PROP_TIS_TIMEOUT, &cap, desc, 0); + + if (ret) + chip->flags &= ~TPM_CHIP_FLAG_IRQ; } /* Register the IRQ and issue a command that will cause an interrupt. If an