Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp176679pxj; Tue, 18 May 2021 00:22:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyImuvs7YA5gPrICM3Att6yo4UmnuRoN7w9Se/Jga81TG1NRG2cWNrdw0n26tbljOiKXCll X-Received: by 2002:a05:6402:515:: with SMTP id m21mr5332009edv.117.1621322536839; Tue, 18 May 2021 00:22:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621322536; cv=none; d=google.com; s=arc-20160816; b=VVH/wdosvwz4gAS16XkhFfKqjS2sQUhHaPqI8wrP0amvIYLGQa+dbmHyEeJkBfqtZn bECf6o9Y9PzumbTjByWoVZkFEMXtZFf6suaCZYG8SU3okCbQIy5PoN1mG2gEWwzR17DE EsBFwKqHDKUvZCIdi7aC7FSZxyf81zA1AOC7PAIeYgYQtnW6VzNga8+fb3mrztWxepEa 9ulyxn0g4nfNrq582KnpuTFmzf2pdw4ZyfEi/7GZ8G7f0iuS+iIUXL4Im795XfqGd2LB gPpvpLOApq3Ju64NzOt15VvQ5htt8WY2i8996b49LqwYBaUj5nVPDb0uQ6TU02tZOV9f Nkpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=TRVIYFWNgBNe1VNDJO7VQiDkLRz0mEhfACWKPVZ6k0k=; b=0wL3ZMzQHvS8XWzdOpipRNaqKHCBycTDk/zKZjRYhDKoX3IuNtv09+zBsjlYyyxz0Y yAJDRQZ6+nf+vqMJA7rFvbs7hsVeVGA5YlepYodsZpcoM3vaxFBlMViCH8eE7dZ2iS8f fJxaxDCuNSKJFpySE+rxOtneYGv774N27j9ahf+ZjQ22QBbMVGBtuWVFePcYaUKxjwTC DmwJuQNOZV9DJQnFqMHgy2F0fFh52ntOsD0yp8/ryaYPiUz/xjqpj63jkMwLawnCxX0P xJvEafGweNNcFlO5fmawFy5okmB41Hg81RJ9m2YI5doGcJy4mH1W9rDvk11+vp6zoBv5 F/QA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=kY0VigoF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id de36si11615392ejc.454.2021.05.18.00.21.53; Tue, 18 May 2021 00:22:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=kY0VigoF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242260AbhEQOyv (ORCPT + 99 others); Mon, 17 May 2021 10:54:51 -0400 Received: from mail.kernel.org ([198.145.29.99]:39072 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240437AbhEQOq1 (ORCPT ); Mon, 17 May 2021 10:46:27 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 1BCE26141A; Mon, 17 May 2021 14:21:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621261305; bh=F0wwMLFZkfjf8sQf792pUgIM9/L+mtzINs5RBxdQOxI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kY0VigoFvdjIeElXB5j4ivsKn/IS0gqXB3h1z9gLXxqQs/LOQMpSg7GOORKqxk08y Z7Q0GYEODjkjdFtWJknocX7aAYV213K3jX0hZkrR6VacmUQjO4ak1BYMsI4nGEcwqn iG9TXMUW/ZnK89PZbhI9QsIcYlZjrd60J4PAHvZI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hans de Goede , Lino Sanfilippo , Jarkko Sakkinen Subject: [PATCH 5.10 003/289] tpm, tpm_tis: Extend locality handling to TPM2 in tpm_tis_gen_interrupt() Date: Mon, 17 May 2021 15:58:48 +0200 Message-Id: <20210517140305.264795892@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210517140305.140529752@linuxfoundation.org> References: <20210517140305.140529752@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jarkko Sakkinen commit e630af7dfb450d1c00c30077314acf33032ff9e4 upstream. The earlier fix (linked) only partially fixed the locality handling bug in tpm_tis_gen_interrupt(), i.e. only for TPM 1.x. Extend the locality handling to cover TPM2. Cc: Hans de Goede Cc: stable@vger.kernel.org Link: https://lore.kernel.org/linux-integrity/20210220125534.20707-1-jarkko@kernel.org/ Fixes: a3fbfae82b4c ("tpm: take TPM chip power gating out of tpm_transmit()") Reported-by: Lino Sanfilippo Signed-off-by: Jarkko Sakkinen Tested-by: Lino Sanfilippo Signed-off-by: Greg Kroah-Hartman --- drivers/char/tpm/tpm_tis_core.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) --- a/drivers/char/tpm/tpm_tis_core.c +++ b/drivers/char/tpm/tpm_tis_core.c @@ -709,16 +709,14 @@ static int tpm_tis_gen_interrupt(struct cap_t cap; int ret; - /* TPM 2.0 */ - if (chip->flags & TPM_CHIP_FLAG_TPM2) - return tpm2_get_tpm_pt(chip, 0x100, &cap2, desc); - - /* TPM 1.2 */ ret = request_locality(chip, 0); if (ret < 0) return ret; - ret = tpm1_getcap(chip, TPM_CAP_PROP_TIS_TIMEOUT, &cap, desc, 0); + 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); release_locality(chip, 0);