[ 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@xxxxxxxxxxxxxxxxx Commit author: Jarkko Sakkinen <jarkko@xxxxxxxxxx> 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@xxxxxxxxxx> Tested-by: Mike Seo <mikeseohyungjin@xxxxxxxxx> Signed-off-by: Jarkko Sakkinen <jarkko@xxxxxxxxxx> + [ 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@xxxxxxxxxxxxx> ## 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 |