From: Sasha Levin <sashal@kernel.org>
To: stable@vger.kernel.org
Cc: bin.lan.cn@eng.windriver.com, Sasha Levin <sashal@kernel.org>
Subject: Re: [PATCH 6.6] tpm: Lock TPM chip in tpm_pm_suspend() first
Date: Thu, 5 Dec 2024 08:34:12 -0500 [thread overview]
Message-ID: <20241205065248-dd3b2441dd98089b@stable.kernel.org> (raw)
In-Reply-To: <20241205022644.164941-1-bin.lan.cn@eng.windriver.com>
[ Sasha's backport helper bot ]
Hi,
The upstream commit SHA1 provided is correct: 9265fed6db601ee2ec47577815387458ef4f047a
WARNING: Author mismatch between patch and upstream commit:
Backport author: bin.lan.cn@eng.windriver.com
Commit author: Jarkko Sakkinen <jarkko@kernel.org>
Status in newer kernel trees:
6.12.y | Present (exact SHA1)
6.11.y | Present (different SHA1: bc203fe416ab)
6.6.y | Not found
Note: The patch differs from the upstream commit:
---
1: 9265fed6db601 ! 1: 7fcb4bafb7f2d tpm: Lock TPM chip in tpm_pm_suspend() first
@@ Metadata
## Commit message ##
tpm: Lock TPM chip in tpm_pm_suspend() first
+ [ Upstream commit 9265fed6db601ee2ec47577815387458ef4f047a ]
+
Setting TPM_CHIP_FLAG_SUSPENDED in the end of tpm_pm_suspend() can be racy
according, as this leaves window for tpm_hwrng_read() to be called while
the operation is in progress. The recent bug report gives also evidence of
@@ Commit message
Reviewed-by: Jerry Snitselaar <jsnitsel@redhat.com>
Tested-by: Mike Seo <mikeseohyungjin@gmail.com>
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
+ [ Don't call tpm2_end_auth_session() for this function does not exist
+ in 6.6.y.]
+ Signed-off-by: Bin Lan <bin.lan.cn@windriver.com>
## drivers/char/tpm/tpm-chip.c ##
@@ drivers/char/tpm/tpm-chip.c: static int tpm_hwrng_read(struct hwrng *rng, void *data, size_t max, bool wait)
@@ drivers/char/tpm/tpm-interface.c: int tpm_pm_suspend(struct device *dev)
- rc = tpm_try_get_ops(chip);
- if (!rc) {
-- if (chip->flags & TPM_CHIP_FLAG_TPM2) {
-- tpm2_end_auth_session(chip);
+- if (chip->flags & TPM_CHIP_FLAG_TPM2)
- tpm2_shutdown(chip, TPM2_SU_STATE);
-- } else {
+- else
- rc = tpm1_pm_suspend(chip, tpm_suspend_pcr);
-- }
-
- tpm_put_ops(chip);
+ if (chip->flags & TPM_CHIP_FLAG_TPM2) {
-+ tpm2_end_auth_session(chip);
+ tpm2_shutdown(chip, TPM2_SU_STATE);
+ goto suspended;
}
---
Results of testing on various branches:
| Branch | Patch Apply | Build Test |
|---------------------------|-------------|------------|
| stable/linux-6.6.y | Success | Success |
prev parent reply other threads:[~2024-12-05 14:45 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-05 2:26 [PATCH 6.6] tpm: Lock TPM chip in tpm_pm_suspend() first bin.lan.cn
2024-12-05 13:34 ` Sasha Levin [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241205065248-dd3b2441dd98089b@stable.kernel.org \
--to=sashal@kernel.org \
--cc=bin.lan.cn@eng.windriver.com \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox