[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <D5AQLQJ7LN9K.3F3RQZVUMH0GG@kernel.org>
Date: Fri, 01 Nov 2024 11:33:13 +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 14/20] tpm: Protect against locality counter
underflow
On Fri Sep 13, 2024 at 11:05 PM EEST, Ross Philipson wrote:
> From: "Daniel P. Smith" <dpsmith@...rtussolutions.com>
>
> Commit 933bfc5ad213 introduced the use of a locality counter to control when a
> locality request is allowed to be sent to the TPM. In the commit, the counter
> is indiscriminately decremented. Thus creating a situation for an integer
> underflow of the counter.
>
> Signed-off-by: Daniel P. Smith <dpsmith@...rtussolutions.com>
> Signed-off-by: Ross Philipson <ross.philipson@...cle.com>
> Reported-by: Kanth Ghatraju <kanth.ghatraju@...cle.com>
Remove reported-by.
> ---
> drivers/char/tpm/tpm_tis_core.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/char/tpm/tpm_tis_core.c b/drivers/char/tpm/tpm_tis_core.c
> index fdef214b9f6b..a6967f312837 100644
> --- a/drivers/char/tpm/tpm_tis_core.c
> +++ b/drivers/char/tpm/tpm_tis_core.c
> @@ -180,7 +180,10 @@ static int tpm_tis_relinquish_locality(struct tpm_chip *chip, int l)
> struct tpm_tis_data *priv = dev_get_drvdata(&chip->dev);
>
> mutex_lock(&priv->locality_count_mutex);
> - priv->locality_count--;
> + if (priv->locality_count > 0)
> + priv->locality_count--;
> + else
> + pr_info("Invalid: locality count dropped below zero\n");
Explain the context.
> if (priv->locality_count == 0)
> __tpm_tis_relinquish_locality(priv, l);
> mutex_unlock(&priv->locality_count_mutex);
BR, Jarkko
Powered by blists - more mailing lists