From patchwork Fri Dec 8 18:46:55 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Steffen X-Patchwork-Id: 10103157 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 9EDE6602A0 for ; Fri, 8 Dec 2017 18:51:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9041728697 for ; Fri, 8 Dec 2017 18:51:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 84C9B28E7F; Fri, 8 Dec 2017 18:51:25 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 15FD028697 for ; Fri, 8 Dec 2017 18:51:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752522AbdLHSvY (ORCPT ); Fri, 8 Dec 2017 13:51:24 -0500 Received: from smtp2.infineon.com ([217.10.52.18]:26579 "EHLO smtp2.infineon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752338AbdLHSvX (ORCPT ); Fri, 8 Dec 2017 13:51:23 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=infineon.com; i=@infineon.com; q=dns/txt; s=IFXMAIL; t=1512759083; x=1544295083; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=U8LfOQZUv0CrkwbBjvZHGUcc5rsXrwA5iDQXogqTIvI=; b=BWO44X+OXnbKLeFbYsVyI/TRf5jo2hZYnWbRIGLJzeWj16OTepK9whV6 09GO4PCoiRf9JHy8kWzWJoW7EkLlsOiEmFy7CKDFpJDW389JSJmyyYzIO IQsKc/7pT6MgPhbgdmDq1Mam5wT3Lc12G7jhueGMu2I+yQdx1ZCvy8f5K k=; X-SBRS: None Received: from unknown (HELO mucxv001.muc.infineon.com) ([172.23.11.16]) by smtp2.infineon.com with ESMTP/TLS/AES256-GCM-SHA384; 08 Dec 2017 19:51:22 +0100 Received: from MUCSE708.infineon.com (mucse708.infineon.com [172.23.7.82]) by mucxv001.muc.infineon.com (Postfix) with ESMTPS; Fri, 8 Dec 2017 19:51:22 +0100 (CET) Received: from ABGN5CG4522MQD.eu.infineon.com (172.23.8.247) by MUCSE708.infineon.com (172.23.7.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.669.32; Fri, 8 Dec 2017 19:51:22 +0100 From: Alexander Steffen To: , , , CC: Alexander Steffen Subject: [RFC][PATCH 6/9] tpm_tis_spi: fix sending wrong data during wait state handling Date: Fri, 8 Dec 2017 19:46:55 +0100 Message-ID: <20171208184658.9588-7-Alexander.Steffen@infineon.com> X-Mailer: git-send-email 2.11.1.windows.1 In-Reply-To: <20171208184658.9588-1-Alexander.Steffen@infineon.com> References: <20171208184658.9588-1-Alexander.Steffen@infineon.com> MIME-Version: 1.0 X-Originating-IP: [172.23.8.247] X-ClientProxiedBy: MUCSE706.infineon.com (172.23.7.80) To MUCSE708.infineon.com (172.23.7.82) Sender: linux-integrity-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-integrity@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When the TPM signals wait states, the driver has to repeat the last byte until the TPM stops signaling wait states and accepts that byte. It should not send a dummy byte, even though that might work with some TPM implementations. Signed-off-by: Alexander Steffen --- drivers/char/tpm/tpm_tis_spi.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/char/tpm/tpm_tis_spi.c b/drivers/char/tpm/tpm_tis_spi.c index c4f511b..2758b41 100644 --- a/drivers/char/tpm/tpm_tis_spi.c +++ b/drivers/char/tpm/tpm_tis_spi.c @@ -88,9 +88,8 @@ static int tpm_tis_spi_transfer(struct tpm_tis_data *data, u32 addr, u16 len, if ((phy->iobuf[3] & 0x01) == 0) { // handle SPI wait states - phy->iobuf[0] = 0; - for (i = 0; i < TPM_RETRY; i++) { + phy->iobuf[0] = addr; spi_xfer.len = 1; spi_message_init(&m); spi_message_add_tail(&spi_xfer, &m);