[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <D5BRGKZLI186.20G9U85Q2XRPP@kernel.org>
Date: Sat, 02 Nov 2024 16:26:11 +0200
From: "Jarkko Sakkinen" <jarkko@...nel.org>
To: "Ross Philipson" <ross.philipson@...cle.com>,
<linux-kernel@...r.kernel.org>, <x86@...nel.org>,
<linux-integrity@...r.kernel.org>, <linux-doc@...r.kernel.org>,
<linux-crypto@...r.kernel.org>, <kexec@...ts.infradead.org>,
<linux-efi@...r.kernel.org>, <iommu@...ts.linux-foundation.org>
Cc: <dpsmith@...rtussolutions.com>, <tglx@...utronix.de>,
<mingo@...hat.com>, <bp@...en8.de>, <hpa@...or.com>,
<dave.hansen@...ux.intel.com>, <ardb@...nel.org>, <mjg59@...f.ucam.org>,
<James.Bottomley@...senpartnership.com>, <peterhuewe@....de>,
<jgg@...pe.ca>, <luto@...capital.net>, <nivedita@...m.mit.edu>,
<herbert@...dor.apana.org.au>, <davem@...emloft.net>, <corbet@....net>,
<ebiederm@...ssion.com>, <dwmw2@...radead.org>, <baolu.lu@...ux.intel.com>,
<kanth.ghatraju@...cle.com>, <andrew.cooper3@...rix.com>,
<trenchboot-devel@...glegroups.com>
Subject: Re: [PATCH v11 16/20] tpm: Make locality requests return consistent
values
On Fri Sep 13, 2024 at 11:05 PM EEST, Ross Philipson wrote:
> From: "Daniel P. Smith" <dpsmith@...rtussolutions.com>
>
> The function tpm_tis_request_locality() is expected to return the locality
> value that was requested, or a negative error code upon failure. If it is called
> while locality_count of struct tis_data is non-zero, no actual locality request
> will be sent. Because the ret variable is initially set to 0, the
> locality_count will still get increased, and the function will return 0. For a
> caller, this would indicate that locality 0 was successfully requested and not
> the state changes just mentioned.
>
> Additionally, the function __tpm_tis_request_locality() provides inconsistent
> error codes. It will provide either a failed IO write or a -1 should it have
> timed out waiting for locality request to succeed.
>
> This commit changes __tpm_tis_request_locality() to return valid negative error
> codes to reflect the reason it fails. It then adjusts the return value check in
> tpm_tis_request_locality() to check for a non-negative return value before
> incrementing locality_cout. In addition, the initial value of the ret value is
> set to a negative error to ensure the check does not pass if
> __tpm_tis_request_locality() is not called.
Tweaked version attached with cruft removed and story cleared.
BR, Jarkko
View attachment "0001-tpm-Support-multiple-localities-in-tpm_tis_request_l.patch" of type "text/x-patch" (1341 bytes)
Powered by blists - more mailing lists