From patchwork Mon Oct 17 23:57:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Lino Sanfilippo X-Patchwork-Id: 13009726 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 48A6AC433FE for ; Mon, 17 Oct 2022 23:58:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229944AbiJQX6Z (ORCPT ); Mon, 17 Oct 2022 19:58:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38952 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231173AbiJQX6T (ORCPT ); Mon, 17 Oct 2022 19:58:19 -0400 Received: from mout.gmx.net (mout.gmx.net [212.227.17.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8FDC586802; Mon, 17 Oct 2022 16:58:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1666051074; bh=buEw+w1lPaY9DnLnvIwHNA83JT8Bq6RdLmvLWuRAigo=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=C1uKCl14AdWDIjY1KVavFgtxvfuBAr1j1iTRRE/BySwSCXiv6Znp7HDjevv+52ZID L1oHKz2kXBovl1q6qaBsK9Sw+91gJEssdVR4zM8qDq+nDiG7aiigu6TWCIsjcsNbNQ J/E5jgQvsUCswnLf0b4ztRBa8Q1kZMVVMcRT4TXk= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from Venus.speedport.ip ([84.162.5.241]) by mail.gmx.net (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MbivG-1pGsbn48pq-00dDlQ; Tue, 18 Oct 2022 01:57:54 +0200 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 v8 11/11] tpm, tpm_tis: Enable interrupt test Date: Tue, 18 Oct 2022 01:57:32 +0200 Message-Id: <20221017235732.10145-12-LinoSanfilippo@gmx.de> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20221017235732.10145-1-LinoSanfilippo@gmx.de> References: <20221017235732.10145-1-LinoSanfilippo@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:G/UrceEJMQh7OfbfZywk0mbMyJC0ez0JbQCh2fp8L4GbW1scecR MxktYbhNp81XSKlyTQJ9vnG6diNUOeH78L/NAZ9vhiEXcVtFynmKRzz3nYChxYS4ruB1vlX c3JAuk7x+zRnawWu9mdx0UDlSiTfd/PpqXNk/HrpCzt2sdHotAWRVFu+YP9KDWNu+kvLiWs nDp0MCO/1CCqktZHvXHsw== X-UI-Out-Filterresults: notjunk:1;V03:K0:QTPKhxW+/Y4=:DG+4oVkJurEO+P5euZJ65W +XszL3dIXeK5rBI1aCcaCbZZpX9P7Ypn5tQWM7sDBQoOrzXCDmqU2tHzYkDqnQYSrMdXuvv6n Zrovy232IVy2kjyJlgCryOZFxou+pjJjKw4sgWK7TVcaCga1Xc4uAYTxiAJtVB7/60NCqueRB Lf6xDWT+XRbF4LEvKBA02sN2s2y2NvSNZ2vyIZCXvoHLCYia6mW+e4t978YmNDhEwKYClw9BB VKgRh8qSuVC1cdrsga1oXnAq3Xjko6Qpv809rG7emQdIXTobUrJWABP2kLVNNuipIbcJCLXBQ g6DQNbp89PBGuG8BhhcZpIK4s0FNi1zyhcWgUfotHgUX01WDG9R97g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9Zxf/6+jfsIB6iD4EcSJ5zLehjsBL14BofJAnLEEZzvu VXExgh1HDTr/+FoqN9FpG7r3qg9eG7rwn3HW2/eJmB0vwy5kpsB3lthlMrpYdWpWhFirlKz0q NRG0ebXnmw9p8AJg404PCV7nGEN75uhCARkSFONWkKy6b 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 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 42f628e52cde..9778860e1598 100644 --- a/drivers/char/tpm/tpm_tis_core.c +++ b/drivers/char/tpm/tpm_tis_core.c @@ -793,11 +793,16 @@ static int tpm_tis_gen_interrupt(struct tpm_chip *chip) if (ret < 0) return 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; + tpm_tis_release_locality(chip, 0); return ret;