From patchwork Mon Nov 11 23:34:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerry Snitselaar X-Patchwork-Id: 11237995 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 72EAE1920 for ; Mon, 11 Nov 2019 23:34:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 513CB2196E for ; Mon, 11 Nov 2019 23:34:28 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="YG6fITkE" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726877AbfKKXe2 (ORCPT ); Mon, 11 Nov 2019 18:34:28 -0500 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:36791 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726845AbfKKXe1 (ORCPT ); Mon, 11 Nov 2019 18:34:27 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1573515266; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Osmocn6A+32FCq+AZZzVX6c3EKPInFHUzdh8/zOxZjQ=; b=YG6fITkEizfKxmoaOeh8g/55sqaXCGWtHzPGl30JCV8OA7zKDqRtg6o7rnwSy3sYzTmGXZ pl7BYR9uyqAYhDq3GTt7X4F38Y85+vazirpbsisbon3sosLyn2EzHci1JST6CSejo9ACOw pDvxYiBwOWxB7tGfNbdcqtuN5J6vgwE= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-394-7pYHOyhaMVGIDXctMbS_0Q-1; Mon, 11 Nov 2019 18:34:23 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id EEA06800D49; Mon, 11 Nov 2019 23:34:21 +0000 (UTC) Received: from cantor.redhat.com (ovpn-116-116.phx2.redhat.com [10.3.116.116]) by smtp.corp.redhat.com (Postfix) with ESMTP id AE131100EBBD; Mon, 11 Nov 2019 23:34:20 +0000 (UTC) From: Jerry Snitselaar To: linux-integrity@vger.kernel.org Cc: Jarkko Sakkinen , Peter Huewe , Jason Gunthorpe , linux-kernel@vger.kernel.org, linux-stable@vger.kernel.org, Christian Bundy Subject: [PATCH] tpm_tis: turn on TPM before calling tpm_get_timeouts Date: Mon, 11 Nov 2019 16:34:18 -0700 Message-Id: <20191111233418.17676-1-jsnitsel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-MC-Unique: 7pYHOyhaMVGIDXctMbS_0Q-1 X-Mimecast-Spam-Score: 0 Sender: linux-integrity-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-integrity@vger.kernel.org With power gating moved out of the tpm_transmit code we need to power on the TPM prior to calling tpm_get_timeouts. Cc: Jarkko Sakkinen Cc: Peter Huewe Cc: Jason Gunthorpe Cc: linux-kernel@vger.kernel.org Cc: linux-stable@vger.kernel.org Fixes: a3fbfae82b4c ("tpm: take TPM chip power gating out of tpm_transmit()") Reported-by: Christian Bundy Signed-off-by: Jerry Snitselaar --- drivers/char/tpm/tpm_tis_core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/char/tpm/tpm_tis_core.c b/drivers/char/tpm/tpm_tis_core.c index 270f43acbb77..cb101cec8f8b 100644 --- a/drivers/char/tpm/tpm_tis_core.c +++ b/drivers/char/tpm/tpm_tis_core.c @@ -974,13 +974,14 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq, * to make sure it works. May as well use that command to set the * proper timeouts for the driver. */ + tpm_chip_start(chip); if (tpm_get_timeouts(chip)) { dev_err(dev, "Could not get TPM timeouts and durations\n"); rc = -ENODEV; + tpm_stop_chip(chip); goto out_err; } - tpm_chip_start(chip); chip->flags |= TPM_CHIP_FLAG_IRQ; if (irq) { tpm_tis_probe_irq_single(chip, intmask, IRQF_SHARED,