Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp4539165ybb; Tue, 7 Apr 2020 09:23:17 -0700 (PDT) X-Google-Smtp-Source: APiQypLstNw2x2hLZ00GKELaGWsxSEm93+G4D831m/8oFN5Q7NCDAPk0aH3UuM0BpM/9DjSIF97v X-Received: by 2002:a9d:7389:: with SMTP id j9mr1338835otk.56.1586276597696; Tue, 07 Apr 2020 09:23:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586276597; cv=none; d=google.com; s=arc-20160816; b=0HxsQW//HTgY5P0iteRHiQdLzyVhY7YBE17MY5NzvucDVCN+c3IaVBuUzrFQ0HYkii b3DpTtHOEdfPi3OMGyakFkc4bsZbjwukO5zSfnr6NW0Qlw64ukhreIM0CML6F8JTlFv7 Vvcc66Ei2ChUAstcngCAxW3K9U8A9QhGDQNMjckGtJJmlh+It8SLd9HOrDCVsLm/uI3j SRporUmXnq9dv53hrLl0Ogc36KtUv5XyvRwSBLHedHJ/ZheovqRskP3VNhijC/cfeAGL vC5lpuYQXu3e0W+tGzyagR+OkLxhmNqMFVva1dbwawPuiwi0EFM4WrEddFwFdpA8yhtC h4dw== 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=SIvDjg+YnVAV/CDH9VPR6Uir5H67ZfLhMpygWCkozYKhqNqqEGlxkJCReu99pBkazv 6u2Lt1gTbbqX8K74XkgqehAF5D/RA5mID9FkxWhZD/ctUbkwGyR5i8WHYHB9pfEMvqoA via5FQ6smUxPUrHWqwElywqqEbAUOWJqwx+DGIArGrJP7hLIJE2acQZJ7xNurFc6zLvg d9laMYhx+9p21Ml4jIo+UDJ1OGPhumITYRG9AXLlGhmCNF3DWLl98FQVusO+izw7JmWn c9JUOLDxlodl6lOewz+yV4Qys4MABZt3tixUSQHOVGePbkiY8znSBLQUC8pnLuO2cimi QOJg== 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 c201si802109oib.57.2020.04.07.09.23.04; Tue, 07 Apr 2020 09:23:17 -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 S1728360AbgDGQWS (ORCPT + 99 others); Tue, 7 Apr 2020 12:22:18 -0400 Received: from 212.199.177.27.static.012.net.il ([212.199.177.27]:40622 "EHLO herzl.nuvoton.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727707AbgDGQWR (ORCPT ); Tue, 7 Apr 2020 12:22:17 -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 037GKs1W002269; Tue, 7 Apr 2020 19:20:54 +0300 Received: by taln60.nuvoton.co.il (Postfix, from userid 10140) id A8684639B0; Tue, 7 Apr 2020 19:20:54 +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, mark.rutland@arm.com, peterhuewe@gmx.de, 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 v6 3/7] tpm: tpm_tis: rewrite "tpm_tis_req_canceled()" Date: Tue, 7 Apr 2020 19:20:40 +0300 Message-Id: <20200407162044.168890-4-amirmizi6@gmail.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20200407162044.168890-1-amirmizi6@gmail.com> References: <20200407162044.168890-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