Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp2370177ybb; Sun, 5 Apr 2020 05:56:33 -0700 (PDT) X-Google-Smtp-Source: APiQypLj3l82Yer8UyBhIZziSvaB0A94ZjcceRQ54Dr748DliNJsC5/yw4Ny5Lum9ixu+TsVc3Po X-Received: by 2002:aca:496:: with SMTP id 144mr9854702oie.121.1586091393240; Sun, 05 Apr 2020 05:56:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586091393; cv=none; d=google.com; s=arc-20160816; b=dpCynMcVwt2Dm8D8EJXrKDC061TbFVnqiubEEXgP5c6eLWXRrbSeZhnfGMH5+h6nw8 blSoiGmNq/OR/fo3ZkQfypiCDFw9J0oMfBZ2fd4WFgeScSXOLMLeUZkjuwstbi4In9z4 NJrKUuXab0W5NCmBLbE5dSMmuMzFAXyRyZn4/Q6hKtGN9RXWgZM4YC9xtBYrBFIEd1e3 hYuHdI6DJUe//5dlJKb69Ysm7nz6PFOwbll7lt/6fnfTsc05TuBKfQmsSY+W1a8S3xae EYyKKvU8A6jZCUKpOYkBILgDcISSc7RNnH0LpSG99YT/AiWTO7a975N4qrVkt4rKm/DF /aMQ== 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; bh=zSvaidsG8W1YXZ2WqHo5kU3FXb5zmY6xuLyCJ/4TOF4=; b=DI3FKP2Y9P3Xlr3w+6JnFHP224WaQV2GT0EmAadlovKwd2dDwpCKk+uqbdiIND3/US TWODxG1ZDq5+0RQNQ87PMLDHxzeIatM7fxXyKuSCjtoNZ1ikyEYb3nLyvGTNCGdRMwp4 1K/C9NUegmpiRH+sECyZMiN50PDuS2x/Xx0ilsI8+tB4lDCchpwXX3bgBYM5+IraN0ep vZmsK7z88bkBMAPLFxerCKaKvweVj/rssKd/1J9K/6fr7H+1N++HUttTmfBQYkaVvi8c etBqv8BLULI6gNQj85j3epW8ah1E5EzQFWJY2KQKEMamtzNTvmldwVTTAsvOt25M96Jg 7OPQ== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l43si6361101ooi.79.2020.04.05.05.56.20; Sun, 05 Apr 2020 05:56:33 -0700 (PDT) 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; 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726788AbgDEMzc (ORCPT + 99 others); Sun, 5 Apr 2020 08:55:32 -0400 Received: from 212.199.177.27.static.012.net.il ([212.199.177.27]:40236 "EHLO herzl.nuvoton.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726473AbgDEMzc (ORCPT ); Sun, 5 Apr 2020 08:55:32 -0400 Received: from taln60.nuvoton.co.il (ntil-fw [212.199.177.25]) by herzl.nuvoton.co.il (8.13.8/8.13.8) with ESMTP id 035CtCQk005490; Sun, 5 Apr 2020 15:55:12 +0300 Received: by taln60.nuvoton.co.il (Postfix, from userid 10140) id 89DA9639B0; Sun, 5 Apr 2020 15:55:12 +0300 (IDT) From: amirmizi6@gmail.com To: Eyal.Cohen@nuvoton.com, jarkko.sakkinen@linux.intel.com, oshrialkoby85@gmail.com, alexander.steffen@infineon.com, robh+dt@kernel.org, "benoit.houyere@st.com--to=mark.rutland"@arm.com, peterhuewe@gmx.de, christophe-h.richard@st.com, jgg@ziepe.ca, arnd@arndb.de, gregkh@linuxfoundation.org Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-integrity@vger.kernel.org, oshri.alkoby@nuvoton.com, tmaimon77@gmail.com, gcwilson@us.ibm.com, kgoldman@us.ibm.com, Dan.Morav@nuvoton.com, oren.tanami@nuvoton.com, shmulik.hager@nuvoton.com, amir.mizinski@nuvoton.com, Amir Mizinski Subject: [PATCH v5 3/7] tpm: tpm_tis: rewrite "tpm_tis_req_canceled()" Date: Sun, 5 Apr 2020 15:53:48 +0300 Message-Id: <20200405125352.183693-4-amirmizi6@gmail.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20200405125352.183693-1-amirmizi6@gmail.com> References: <20200405125352.183693-1-amirmizi6@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Amir Mizinski Using this function while read/write data resulted in aborted operation. After investigating according to TCG TPM Profile (PTP) Specifications, i found cancel should happen only if TPM_STS.commandReady bit is lit and couldn't find a case when the current condition is valid. So i'm removing the case for "TPM_VID_WINBOND" since we have no need for it Also default comparison is wrong. only cmdReady bit need to be compared instead of the full lower status register byte. Fixes: 1f86605 (tpm: Fix cancellation of TPM commands (polling mode)) Signed-off-by: Amir Mizinski --- drivers/char/tpm/tpm_tis_core.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/char/tpm/tpm_tis_core.c b/drivers/char/tpm/tpm_tis_core.c index 6c4f232..453d7ef 100644 --- a/drivers/char/tpm/tpm_tis_core.c +++ b/drivers/char/tpm/tpm_tis_core.c @@ -713,13 +713,10 @@ static bool tpm_tis_req_canceled(struct tpm_chip *chip, u8 status) struct tpm_tis_data *priv = dev_get_drvdata(&chip->dev); switch (priv->manufacturer_id) { - case TPM_VID_WINBOND: - return ((status == TPM_STS_VALID) || - (status == (TPM_STS_VALID | TPM_STS_COMMAND_READY))); case TPM_VID_STM: return (status == (TPM_STS_VALID | TPM_STS_COMMAND_READY)); default: - return (status == TPM_STS_COMMAND_READY); + return ((status & TPM_STS_COMMAND_READY) == TPM_STS_COMMAND_READY); } } -- 2.7.4