From patchwork Wed Jun 29 23:26:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Lino Sanfilippo X-Patchwork-Id: 12900801 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 561AFCCA481 for ; Wed, 29 Jun 2022 23:27:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231491AbiF2X1p (ORCPT ); Wed, 29 Jun 2022 19:27:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33358 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231324AbiF2X1j (ORCPT ); Wed, 29 Jun 2022 19:27:39 -0400 Received: from mout.gmx.net (mout.gmx.net [212.227.15.15]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C789F26546; Wed, 29 Jun 2022 16:27:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1656545247; bh=trJhlzE+9h7nejkPPDRUJXRB5bu1x2yTJPTeKLNCj6w=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=ZJfr34/M7u05kxJerTQq/7yMBUHy75csgDCyOplAhX2i9/PW8SWuhB8TPUAX1hvAI wiAbEPmy6L/sG1Yi9Wvo3Oebaid7cfpJKN/UUn8aDBqahcK6ZTUDfbuLq2/xRx21ZE 2kxrWEPihk4EA43ufBDHy8eBeA8HiEoibkYQkkkI= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from localhost.localdomain ([46.223.3.23]) by mail.gmx.net (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1Mq2j2-1nKixY457C-00n7un; Thu, 30 Jun 2022 01:27:27 +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, l.sanfilippo@kunbus.com, LinoSanfilippo@gmx.de, lukas@wunner.de, p.rosenberger@kunbus.com Subject: [PATCH v7 10/10] tpm, tpm_tis: Enable interrupt test Date: Thu, 30 Jun 2022 01:26:53 +0200 Message-Id: <20220629232653.1306735-11-LinoSanfilippo@gmx.de> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220629232653.1306735-1-LinoSanfilippo@gmx.de> References: <20220629232653.1306735-1-LinoSanfilippo@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:wD89YvMA7Ghz21K7RCd1iGNpk5t5Qtb8lm2ALSnWhZzJkJD+cMW SPNERSZsdCRFDxdzyS4/CstbmOXywFpk2oG3UeQ9fEFX3bESMfr4Nm/puceFN3H83gKREFq I6kaAD2jKwIfWaeB9lXMXmUv3YWGB/6R6QZrXIqBwH8dcKx0jmvQ2ExnWvrbQ5OokPpyn33 cPw6JYgfSctF9C51icMCw== X-UI-Out-Filterresults: notjunk:1;V03:K0:3aAohqBAv5Y=:LDpEX1KrDh/NMyxlHknzpI aLk2uxA8LH54kya7/5t7LsrdH6sKMjSz7T1ewILGcxNaD9VKeWhmYiHLNOve4ryICDf+HczIp qByFA7esuGjqtnkDPvFJ2KZ+gMroFqnV3ROVC3WD2tl0ur39Xweq45ukpdceTdEHR8YH/XUBE hpLF9fh4l8Y7G5tGK7Ck2YkwmMaVNQEb+hXmVJNUiW06O8VCVEaw5xYGyyJKEH7yyERb9ecVm MWXC3xV7BVozO9u2STXZSf1CUVU9M+T9CRG9c4Jug3pHbRaTCC4ycXRlXNfSx5Al8CGpvT1e3 O6CMneZxRcStklvtsG+4c8/XMZTFPHLWkto6Cknoec9mVUX3/FW+bIgpMuXvlRP3NlumRuc2r PZqJVV1aZC79oYSLqsl4CwS3uZ7lGDPL5ppL/B66GLeEiQNrkjwphEO+jVNxOf2lvwH3wmLpp 9LvNDi0J53VON8ZNWwpK4MNknGWtQkckAt7t5y4lFgewLEXcZinPWQMj6zR3Am1XUOnsPNsah 8U78JGXjWe5vKhMv0vyOmiFU51o6jwaUCBMpLbCd+/XBtv6Sb7/AH0geNOzJ5hHqaISZdOgmu RfcC035Bp+0CX3HHWhaXM2GNF/2paoAXHtHgt6ntPwfs0K5i9jPwxrqkcbRhx22OX3NWk1YXz ld1bu/CF0E46YYt0KqaKK73t4wI5sm3YVO3Y0aIs8WsJs7Qlvvz6fps99kFM/zs10iTFMNKdD iQ+TswGONBYF9nZ0ttkySNEy4ciDUUJHEsB4GOlu809y/VmdkjooLnuqTtQfXZJvGBU5kSVT9 J7bfvMXzdLCR/5BwWpoQZjx4FAf3z3bhckzNIiq4bNo7RKxdBSRmmtB/y7mtJ5zrgR2r1VcBi bKz+1H+R1gI+Dv/oOKDn3u0S0ZO0c4hK1GY10yx47fqdCJRUAqfhdT3bFBv2cxuphkYa8qk4U hRZf7VsUIxfOEg+ul9A0rZepitwD3KR20zGVd+ZH9+6cBfX84aIYnMLf7gZqa8wHm6QuGTYvj 6DzOFBY940x/r9QFNO4OEXPXj/HnYB0vQCTcX6YY+SFsnHb2dYp5c4TAMZ3RLd1h2B5hw3WUp iT1U5ckAsJBIt/MUguD45uggXYXU52WlALqdZd76MZBuZiN8t3NQz4tSg== 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 --- 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 307a7a3a55c6..e0889c152909 100644 --- a/drivers/char/tpm/tpm_tis_core.c +++ b/drivers/char/tpm/tpm_tis_core.c @@ -782,11 +782,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;